stream: fix nested compose error propagation by mcollina · Pull Request #62556 · nodejs/node

@mcollina

@mcollina

@nodejs-github-bot

Review requested:

  • @nodejs/streams

ronag

@codecov

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.70%. Comparing base (53bcd11) to head (f6b3adb).
⚠️ Report is 53 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main   #62556     +/-   ##
=========================================
  Coverage   89.70%   89.70%             
=========================================
  Files         678      695     +17     
  Lines      207195   214175   +6980     
  Branches    39730    41018   +1288     
=========================================
+ Hits       185862   192129   +6267     
- Misses      13438    14083    +645     
- Partials     7895     7963     +68     
Files with missing lines Coverage Δ
lib/internal/streams/duplexify.js 96.91% <100.00%> (+0.34%) ⬆️
lib/internal/streams/from.js 86.75% <100.00%> (+1.18%) ⬆️

... and 110 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

aduh95

Comment on lines +128 to +130

for await (const chunk of source) {
yield chunk;
}

Choose a reason for hiding this comment

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

for await (const chunk of source) {
yield chunk;
}
yield* source;

aduh95

const stream = Readable.from(['hello'])
.compose(async function *(source) {
for await (const chunk of source) {
throw new Error(`boom: ${chunk}`);

Choose a reason for hiding this comment

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

To fix the linter error

throw new Error(`boom: ${chunk}`);
yield chunk;
throw new Error(`boom: ${chunk}`);

aduh95

if (resolve !== null) {
const _resolve = resolve;
resolve = null;
_resolve({ done: true, cb() {} });

Choose a reason for hiding this comment

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

_resolve({ done: true, cb() {} });
_resolve({ __proto__: null, done: true, cb() {} });