Skip to content

Commit 0b2f09f

Browse files
committed
test: avoid no-yield generator in stream iter share test
1 parent ed412f7 commit 0b2f09f

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

test/parallel/test-stream-iter-share-async.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,22 @@ async function testShareAbortSignalWhileSourcePullPending() {
162162
const sourceStartedPromise = new Promise((resolve) => {
163163
sourceStarted = resolve;
164164
});
165-
async function* source() {
166-
await new Promise((resolve) => {
167-
resume = resolve;
168-
sourceStarted();
169-
});
170-
}
171-
const shared = share(source(), { signal: ac.signal });
165+
const source = {
166+
__proto__: null,
167+
[Symbol.asyncIterator]() {
168+
return {
169+
__proto__: null,
170+
async next() {
171+
await new Promise((resolve) => {
172+
resume = resolve;
173+
sourceStarted();
174+
});
175+
return { __proto__: null, done: true, value: undefined };
176+
},
177+
};
178+
},
179+
};
180+
const shared = share(source, { signal: ac.signal });
172181
const iter1 = shared.pull()[Symbol.asyncIterator]();
173182
const iter2 = shared.pull()[Symbol.asyncIterator]();
174183
const read1 = iter1.next();

0 commit comments

Comments
 (0)