Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve assert messages in stream-pipe-await-drain-manual-resume #16884

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
10 changes: 7 additions & 3 deletions test/parallel/test-stream-pipe-await-drain-manual-resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ readable.once('pause', common.mustCall(() => {
assert.strictEqual(
readable._readableState.awaitDrain,
1,
'awaitDrain doesn\'t increase'
'Expected awaitDrain to equal 1 but instead got ' +
`${readable._readableState.awaitDrain}`
);
// First pause, resume manually. The next write() to writable will still
// return false, because chunks are still being buffered, so it will increase
// the awaitDrain counter again.

process.nextTick(common.mustCall(() => {
readable.resume();
}));
Expand All @@ -43,7 +45,8 @@ readable.once('pause', common.mustCall(() => {
assert.strictEqual(
readable._readableState.awaitDrain,
1,
'.resume() does not reset counter'
'.resume() should not reset the counter but instead got ' +
`${readable._readableState.awaitDrain}`
);
// Second pause, handle all chunks from now on. Once all callbacks that
// are currently queued up are handled, the awaitDrain drain counter should
Expand All @@ -64,7 +67,8 @@ writable.on('finish', common.mustCall(() => {
assert.strictEqual(
readable._readableState.awaitDrain,
0,
'awaitDrain not 0 after all chunks are written'
'awaitDrain should equal 0 after all chunks are written but instead got' +
`${readable._readableState.awaitDrain}`
);
// Everything okay, all chunks were written.
}));