Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
ronag committed Aug 24, 2019
commit 2ab23999d7d2b289fbeab8ea2e4c8a8d30999da0
1 change: 0 additions & 1 deletion lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ function needFinish(state) {
return (state.ending &&
state.length === 0 &&
state.bufferedRequest === null &&
!state.errorEmitted &&
!state.finished &&
!state.writing);
}
Expand Down
16 changes: 9 additions & 7 deletions test/parallel/test-stream-writable-write-writev-finish.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ const stream = require('stream');
cb(new Error('write test error'));
};

writable.on('finish', common.mustNotCall());
writable.on('prefinish', common.mustNotCall());
let firstError = false;
writable.on('finish', common.mustCall(function() {
assert.strictEqual(firstError, true);
}));

writable.on('prefinish', common.mustCall());

writable.on('error', common.mustCall((er) => {
assert.strictEqual(er.message, 'write test error');
firstError = true;
}));

writable.end('test');
Expand All @@ -33,10 +38,7 @@ const stream = require('stream');

writable.on('finish', common.mustNotCall());
writable.on('prefinish', common.mustNotCall());

writable.on('error', common.mustCall((er) => {
assert.strictEqual(er.message, 'write test error');
}));
writable.on('error', common.mustCall());

writable.end('test');
}
Expand All @@ -53,7 +55,7 @@ const stream = require('stream');
};

writable.on('finish', common.mustNotCall());
writable.on('prefinish', common.mustNotCall());
writable.on('prefinish', common.mustCall());

writable.on('error', common.mustCall((er) => {
assert.strictEqual(er.message, 'writev test error');
Expand Down