Skip to content

Commit

Permalink
Test whether stream stalls when next() never settles
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Jan 14, 2021
1 parent 3b5ea5a commit 50b37b0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions streams/readable-streams/from.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,26 @@ promise_test(async t => {

}, `ReadableStream.from: stream errors when next() rejects`);

promise_test(async () => {

const iterable = {
next() {
return new Promise(() => {});
},
[Symbol.asyncIterator]: () => iterable
};

const rs = ReadableStream.from(iterable);
const reader = rs.getReader();

await Promise.race([
reader.read().then(() => assert_unreached(), () => assert_unreached()),
reader.closed.then(() => assert_unreached(), () => assert_unreached()),
flushAsyncEvents()
]);

}, 'ReadableStream.from: stream stalls when next() never settles');

promise_test(async () => {

let nextCalls = 0;
Expand Down

0 comments on commit 50b37b0

Please sign in to comment.