Skip to content

Commit

Permalink
test: fixing broken test
Browse files Browse the repository at this point in the history
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: #28345
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
MelinaMejia95 authored and targos committed Jul 2, 2019
1 parent d88c697 commit cd78c5e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/parallel/test-readable-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -22,7 +22,7 @@ async function toReadableBasicSupport() {
}

async function toReadableSyncIterator() {
function * generate() {
function* generate() {
yield 'a';
yield 'b';
yield 'c';
Expand Down Expand Up @@ -64,7 +64,7 @@ async function toReadableString() {
}

async function toReadableOnData() {
async function * generate() {
async function* generate() {
yield 'a';
yield 'b';
yield 'c';
Expand All @@ -86,7 +86,7 @@ async function toReadableOnData() {
}

async function toReadableOnDataNonObject() {
async function * generate() {
async function* generate() {
yield 'a';
yield 'b';
yield 'c';
Expand All @@ -109,24 +109,22 @@ async function toReadableOnDataNonObject() {
}

async function destroysTheStreamWhenThrowing() {
async function * generate() {
async function* generate() {
throw new Error('kaboom');
}

const stream = Readable.from(generate());

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();
}
Expand Down

0 comments on commit cd78c5e

Please sign in to comment.