Skip to content

fix: handle .nothrow() option in ProcessProcess[AsyncIterator]#1217

Merged
antonmedv merged 1 commit intogoogle:mainfrom
antongolub:fix-async-iter-nothrow
Jun 3, 2025
Merged

fix: handle .nothrow() option in ProcessProcess[AsyncIterator]#1217
antonmedv merged 1 commit intogoogle:mainfrom
antongolub:fix-async-iter-nothrow

Conversation

@antongolub
Copy link
Collaborator

closes #1216

  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub requested a review from Copilot June 3, 2025 12:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds handling for the .nothrow() option in both the async iterator and promise-based ProcessPromise API, ensuring that errors are suppressed when requested.

  • Introduce a test for async iteration with .nothrow()
  • Early-return from the async iterator when nothrow is enabled
  • Mirror the change in the compiled CommonJS output and bump the size limit

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/core.test.js Add tests covering .nothrow() behavior
src/core.ts Add if (this.isNothrow()) return in async iterator
build/core.cjs Replicate the early-return in the compiled output
.size-limit.json Update size limit to reflect the new bundle size
Comments suppressed due to low confidence (1)

test/core.test.js:1052

  • [nitpick] The indentation of this it block doesn’t match the surrounding tests. Align it with the existing two-space indent level for consistency.
      it('handles .nothrow() correctly', async () => {

Comment on lines +1094 to +1097
{
const { exitCode } = await $`exit 42`.nothrow()
assert.equal(exitCode, 42)
}
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This extra block ({ ... }) around the first assertion is unnecessary and adds visual noise. Consider removing it to simplify the test.

Suggested change
{
const { exitCode } = await $`exit 42`.nothrow()
assert.equal(exitCode, 42)
}
const { exitCode } = await $`exit 42`.nothrow()
assert.equal(exitCode, 42)

Copilot uses AI. Check for mistakes.
@antongolub antongolub requested a review from antonmedv June 3, 2025 12:08
@antonmedv antonmedv merged commit 7138b05 into google:main Jun 3, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: .nothrow() does not work with async iterator

3 participants