From d597317a209fcf9e0c233093b2adc8f71129b9ef Mon Sep 17 00:00:00 2001 From: Katie Stockton Roberts Date: Wed, 8 Nov 2017 12:28:47 +0000 Subject: [PATCH] test: improve assert messages in stream test In test-stream-pipe-await-train-manual-resume, include unexpected value in error messages. PR-URL: https://github.com/nodejs/node/pull/16884 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott --- .../test-stream-pipe-await-drain-manual-resume.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-pipe-await-drain-manual-resume.js b/test/parallel/test-stream-pipe-await-drain-manual-resume.js index bd7332c7fabc50..37acead9969443 100644 --- a/test/parallel/test-stream-pipe-await-drain-manual-resume.js +++ b/test/parallel/test-stream-pipe-await-drain-manual-resume.js @@ -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(); })); @@ -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 @@ -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. }));