test: use assert.rejects
This verifies that the test actually rejects at this point by using `assert.rejects` instead of `try / catch`. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
3d6533ea02
commit
3a6eba3de6
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user