test: fixing broken test
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 <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
945134361f
commit
fad3b64350
@ -6,7 +6,7 @@ const { Readable } = require('stream');
|
|||||||
const { strictEqual } = require('assert');
|
const { strictEqual } = require('assert');
|
||||||
|
|
||||||
async function toReadableBasicSupport() {
|
async function toReadableBasicSupport() {
|
||||||
async function * generate() {
|
async function* generate() {
|
||||||
yield 'a';
|
yield 'a';
|
||||||
yield 'b';
|
yield 'b';
|
||||||
yield 'c';
|
yield 'c';
|
||||||
@ -22,7 +22,7 @@ async function toReadableBasicSupport() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toReadableSyncIterator() {
|
async function toReadableSyncIterator() {
|
||||||
function * generate() {
|
function* generate() {
|
||||||
yield 'a';
|
yield 'a';
|
||||||
yield 'b';
|
yield 'b';
|
||||||
yield 'c';
|
yield 'c';
|
||||||
@ -64,7 +64,7 @@ async function toReadableString() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toReadableOnData() {
|
async function toReadableOnData() {
|
||||||
async function * generate() {
|
async function* generate() {
|
||||||
yield 'a';
|
yield 'a';
|
||||||
yield 'b';
|
yield 'b';
|
||||||
yield 'c';
|
yield 'c';
|
||||||
@ -86,7 +86,7 @@ async function toReadableOnData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toReadableOnDataNonObject() {
|
async function toReadableOnDataNonObject() {
|
||||||
async function * generate() {
|
async function* generate() {
|
||||||
yield 'a';
|
yield 'a';
|
||||||
yield 'b';
|
yield 'b';
|
||||||
yield 'c';
|
yield 'c';
|
||||||
@ -109,7 +109,7 @@ async function toReadableOnDataNonObject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function destroysTheStreamWhenThrowing() {
|
async function destroysTheStreamWhenThrowing() {
|
||||||
async function * generate() {
|
async function* generate() {
|
||||||
throw new Error('kaboom');
|
throw new Error('kaboom');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,16 +117,14 @@ async function destroysTheStreamWhenThrowing() {
|
|||||||
|
|
||||||
stream.read();
|
stream.read();
|
||||||
|
|
||||||
try {
|
const [err] = await once(stream, 'error');
|
||||||
await once(stream, 'error');
|
strictEqual(err.message, 'kaboom');
|
||||||
} catch (err) {
|
strictEqual(stream.destroyed, true);
|
||||||
strictEqual(err.message, 'kaboom');
|
|
||||||
strictEqual(stream.destroyed, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function asTransformStream() {
|
async function asTransformStream() {
|
||||||
async function * generate(stream) {
|
async function* generate(stream) {
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
yield chunk.toUpperCase();
|
yield chunk.toUpperCase();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user