Skip to content

Commit cd78c5e

Browse files
MelinaMejia95targos
authored andcommitted
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: #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]>
1 parent d88c697 commit cd78c5e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

test/parallel/test-readable-from.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { Readable } = require('stream');
66
const { strictEqual } = require('assert');
77

88
async function toReadableBasicSupport() {
9-
async function * generate() {
9+
async function* generate() {
1010
yield 'a';
1111
yield 'b';
1212
yield 'c';
@@ -22,7 +22,7 @@ async function toReadableBasicSupport() {
2222
}
2323

2424
async function toReadableSyncIterator() {
25-
function * generate() {
25+
function* generate() {
2626
yield 'a';
2727
yield 'b';
2828
yield 'c';
@@ -64,7 +64,7 @@ async function toReadableString() {
6464
}
6565

6666
async function toReadableOnData() {
67-
async function * generate() {
67+
async function* generate() {
6868
yield 'a';
6969
yield 'b';
7070
yield 'c';
@@ -86,7 +86,7 @@ async function toReadableOnData() {
8686
}
8787

8888
async function toReadableOnDataNonObject() {
89-
async function * generate() {
89+
async function* generate() {
9090
yield 'a';
9191
yield 'b';
9292
yield 'c';
@@ -109,24 +109,22 @@ async function toReadableOnDataNonObject() {
109109
}
110110

111111
async function destroysTheStreamWhenThrowing() {
112-
async function * generate() {
112+
async function* generate() {
113113
throw new Error('kaboom');
114114
}
115115

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

118118
stream.read();
119119

120-
try {
121-
await once(stream, 'error');
122-
} catch (err) {
123-
strictEqual(err.message, 'kaboom');
124-
strictEqual(stream.destroyed, true);
125-
}
120+
const [err] = await once(stream, 'error');
121+
strictEqual(err.message, 'kaboom');
122+
strictEqual(stream.destroyed, true);
123+
126124
}
127125

128126
async function asTransformStream() {
129-
async function * generate(stream) {
127+
async function* generate(stream) {
130128
for await (const chunk of stream) {
131129
yield chunk.toUpperCase();
132130
}

0 commit comments

Comments
 (0)