Skip to content

Commit 8327273

Browse files
committed
Tests: bump web-streams-polyfill to v4 to fix tests
1 parent ec34e8a commit 8327273

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"ts-node": "^10.9.2",
4848
"tsx": "^4.7.0",
4949
"typescript": "^5.5.2",
50-
"web-streams-polyfill": "^3.3.2"
50+
"web-streams-polyfill": "^4.0.0"
5151
},
5252
"peerDependencies": {
5353
"typescript": ">=4.2"

test/node.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ describe('Node integration tests', () => {
3737
it('polyfilled web stream cannot be converted into node native stream', async () => {
3838
const { ReadableStream: PolyfilledReadableStream } = await import ('web-streams-polyfill');
3939

40-
// this test is just to keep track that this behaviour is expected
40+
// this test is just to keep track that this behaviour is expected: it does not cause a TS error, but a runtime one
4141
const input = 'chunk';
42-
const stream = new PolyfilledReadableStream({
42+
const stream: NodeWebReadableStream<string> = new PolyfilledReadableStream<string>({
4343
start(controller) {
4444
controller.enqueue(input);
4545
controller.close();
4646
}
4747
});
4848
const streamedData = toStream(stream);
49-
// @ts-expect-error `fromWeb` does not accept the polyfilled stream
49+
// `fromWeb` does not accept the polyfilled stream
5050
expect(() => NodeNativeReadableStream.fromWeb(streamedData)).to.throw(/must be an instance of ReadableStream/);
5151
});
5252
});

test/typescript.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const newEmptyWebStream = <T extends Data>(): WebStream<T> => new WebReadableStr
3333
const expectedWebStreamButActualNodeStream: WebStream<string> = toStream(nodeWebStream);
3434
assert(expectedWebStreamButActualNodeStream instanceof NodeWebReadableStream);
3535
const newStringStream: Stream<string> = toStream('chunk');
36-
assert(newStringStream instanceof WebReadableStream); // ReadableStream is polyfilled
36+
assert(newStringStream instanceof NodeWebReadableStream);
3737
// @ts-expect-error detect type parameter mismatch
3838
const anotherStringStream: Stream<Uint8Array> = toStream('chunk');
39-
assert(anotherStringStream instanceof WebReadableStream); // ReadableStream is polyfilled
39+
assert(anotherStringStream instanceof NodeWebReadableStream);
4040

4141
assert(isArrayStream(new ArrayStream())) ; // ensure Array is actually extended in e.g. es5
4242

0 commit comments

Comments
 (0)