Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4d782c4

Browse filesBrowse files
hristijankikotargos
authored andcommitted
test: improve assert error messages
Improve the assert error message so it includes actual value in the error message. PR-URL: #21160 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 65b9c42 commit 4d782c4
Copy full SHA for 4d782c4

File tree

Expand file treeCollapse file tree

1 file changed

+14
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-6
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-stream-pipe-await-drain.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-pipe-await-drain.js
+14-6Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ writer1._write = common.mustCall(function(chunk, encoding, cb) {
2323
}, 1);
2424

2525
writer1.once('chunk-received', function() {
26-
assert.strictEqual(reader._readableState.awaitDrain, 0,
27-
'initial value is not 0');
26+
assert.strictEqual(
27+
reader._readableState.awaitDrain,
28+
0,
29+
'awaitDrain initial value should be 0, actual is ' +
30+
reader._readableState.awaitDrain
31+
);
2832
setImmediate(function() {
2933
// This one should *not* get through to writer1 because writer2 is not
3034
// "done" processing.
@@ -35,8 +39,10 @@ writer1.once('chunk-received', function() {
3539
// A "slow" consumer:
3640
writer2._write = common.mustCall(function(chunk, encoding, cb) {
3741
assert.strictEqual(
38-
reader._readableState.awaitDrain, 1,
39-
'awaitDrain isn\'t 1 after first push'
42+
reader._readableState.awaitDrain,
43+
1,
44+
'awaitDrain should be 1 after first push, actual is ' +
45+
reader._readableState.awaitDrain
4046
);
4147
// Not calling cb here to "simulate" slow stream.
4248
// This should be called exactly once, since the first .write() call
@@ -45,8 +51,10 @@ writer2._write = common.mustCall(function(chunk, encoding, cb) {
4551

4652
writer3._write = common.mustCall(function(chunk, encoding, cb) {
4753
assert.strictEqual(
48-
reader._readableState.awaitDrain, 2,
49-
'awaitDrain isn\'t 2 after second push'
54+
reader._readableState.awaitDrain,
55+
2,
56+
'awaitDrain should be 2 after second push, actual is ' +
57+
reader._readableState.awaitDrain
5058
);
5159
// Not calling cb here to "simulate" slow stream.
5260
// This should be called exactly once, since the first .write() call

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.