Skip to content
Permalink
Browse files

test: use assert.rejects

This verifies that the test actually rejects at this point by using
`assert.rejects` instead of `try / catch`.

PR-URL: #27123
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
BridgeAR committed Apr 7, 2019
1 parent 3d6533e commit 3a6eba3de60e6ae3bf8d99b1f502f5c26cdead2f
Showing with 7 additions and 5 deletions.
  1. +7 −5 test/parallel/test-stream-readable-async-iterators.js
@@ -353,11 +353,13 @@ async function tests() {
assert.strictEqual(e, err);
}));
readable.destroy(err);
try {
await readable[Symbol.asyncIterator]().next();
} catch (e) {
assert.strictEqual(e, err);
}
await assert.rejects(
readable[Symbol.asyncIterator]().next(),
(e) => {
assert.strictEqual(e, err);
return true;
}
);
}

{

0 comments on commit 3a6eba3

Please sign in to comment.
You can’t perform that action at this time.