diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index 99b40d368f8c33..b50a6b1734b32b 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/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; + } + ); } {