Skip to content

Commit 3a6eba3

Browse files
committedApr 10, 2019
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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3d6533e commit 3a6eba3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎test/parallel/test-stream-readable-async-iterators.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,13 @@ async function tests() {
353353
assert.strictEqual(e, err);
354354
}));
355355
readable.destroy(err);
356-
try {
357-
await readable[Symbol.asyncIterator]().next();
358-
} catch (e) {
359-
assert.strictEqual(e, err);
360-
}
356+
await assert.rejects(
357+
readable[Symbol.asyncIterator]().next(),
358+
(e) => {
359+
assert.strictEqual(e, err);
360+
return true;
361+
}
362+
);
361363
}
362364

363365
{

0 commit comments

Comments
 (0)
Please sign in to comment.