From cd78c5ef7e9c447cc3797235891438a0f023943d Mon Sep 17 00:00:00 2001 From: melinamejia95 Date: Fri, 21 Jun 2019 16:20:39 -0500 Subject: [PATCH] test: fixing broken test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test didn't throw the error, it was just returning it. So I removed the try/catch and assigned the error to a variable PR-URL: https://github.com/nodejs/node/pull/28345 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil Reviewed-By: Michaƫl Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- test/parallel/test-readable-from.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-readable-from.js b/test/parallel/test-readable-from.js index a441f743ccf756..e43cec6b1e5246 100644 --- a/test/parallel/test-readable-from.js +++ b/test/parallel/test-readable-from.js @@ -6,7 +6,7 @@ const { Readable } = require('stream'); const { strictEqual } = require('assert'); async function toReadableBasicSupport() { - async function * generate() { + async function* generate() { yield 'a'; yield 'b'; yield 'c'; @@ -22,7 +22,7 @@ async function toReadableBasicSupport() { } async function toReadableSyncIterator() { - function * generate() { + function* generate() { yield 'a'; yield 'b'; yield 'c'; @@ -64,7 +64,7 @@ async function toReadableString() { } async function toReadableOnData() { - async function * generate() { + async function* generate() { yield 'a'; yield 'b'; yield 'c'; @@ -86,7 +86,7 @@ async function toReadableOnData() { } async function toReadableOnDataNonObject() { - async function * generate() { + async function* generate() { yield 'a'; yield 'b'; yield 'c'; @@ -109,7 +109,7 @@ async function toReadableOnDataNonObject() { } async function destroysTheStreamWhenThrowing() { - async function * generate() { + async function* generate() { throw new Error('kaboom'); } @@ -117,16 +117,14 @@ async function destroysTheStreamWhenThrowing() { stream.read(); - try { - await once(stream, 'error'); - } catch (err) { - strictEqual(err.message, 'kaboom'); - strictEqual(stream.destroyed, true); - } + const [err] = await once(stream, 'error'); + strictEqual(err.message, 'kaboom'); + strictEqual(stream.destroyed, true); + } async function asTransformStream() { - async function * generate(stream) { + async function* generate(stream) { for await (const chunk of stream) { yield chunk.toUpperCase(); }