fix(stream-node): next always returns IteratorResult
MODIFY
packages/stream-node/test/test-stream-node.js
packages/stream-node/test/test-stream-node.js
@@ -61,7 +61,12 @@ test('stream to and from Node.js reader/writer', async (/** @type {import('ava')
child.send({});
}
// eslint-disable-next-line no-await-in-loop
- await nextP;
+ const { done } = await nextP;
+
+ if (done) {
+ t.log('done');
+ return;
+ }
i = j;
chunkLength *= 2;
@@ -107,7 +112,11 @@ test('stream write error (EPIPE due to exit)', async (/** @type {import('ava').E
t.log('->', i, j);
// eslint-disable-next-line no-await-in-loop
- await writer.next(scratch.subarray(i, j));
+ const { done } = await writer.next(scratch.subarray(i, j));
+ if (done) {
+ t.log('done');
+ return;
+ }
i = j;
chunkLength *= 2;

MODIFY
packages/stream-node/writer.js
packages/stream-node/writer.js
@@ -57,7 +57,7 @@ export const makeNodeWriter = writer => {
} else {
resolve(undefined);
}
- }),
+ }).then(() => ({ done: false, value: undefined })),
]);
},
async return() {

fix(stream-node): next always returns IteratorResult