Skip to content

Commit

Permalink
Tests: bump web-streams-polyfill to v4 to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larabr committed Jun 21, 2024
1 parent 4f99d7f commit f088a4a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ts-node": "^10.9.2",
"tsx": "^4.7.0",
"typescript": "^5.5.2",
"web-streams-polyfill": "^3.3.2"
"web-streams-polyfill": "^4.0.0"
},
"peerDependencies": {
"typescript": ">=4.2"
Expand Down
6 changes: 3 additions & 3 deletions test/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ describe('Node integration tests', () => {
it('polyfilled web stream cannot be converted into node native stream', async () => {
const { ReadableStream: PolyfilledReadableStream } = await import ('web-streams-polyfill');

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

0 comments on commit f088a4a

Please sign in to comment.