Skip to content

Commit b73393c

Browse files
fix: add WritableStream (#40)
Co-authored-by: jamie-moyes-depop <[email protected]>
1 parent d31545f commit b73393c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This project "fixes" the following global APIs, overriding whichever polyfills t
4444
- `URLSearchParams`
4545
- `BroadcastChannel`
4646
- `TransformStream`
47+
- `WritableStream`
4748

4849
## Getting started
4950

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class FixedJSDOMEnvironment extends JSDOMEnvironment {
3535

3636
this.global.BroadcastChannel = BroadcastChannel
3737
this.global.TransformStream = TransformStream
38+
this.global.WritableStream = WritableStream
3839
}
3940
}
4041

index.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { URL: BuiltinURL } = require('node:url')
22
const {
33
BroadcastChannel: BuiltinBroadcastChannel,
44
} = require('node:worker_threads')
5-
const { TransformStream: BuiltinTransformStream } = require('node:stream/web')
5+
const { TransformStream: BuiltinTransformStream, WritableStream: BuiltinWritableStream } = require('node:stream/web')
66

77
test('exposes "Blob"', async () => {
88
expect(globalThis).toHaveProperty('Blob')
@@ -170,3 +170,9 @@ test('exposes "TransformStream"', () => {
170170
const channel = new TransformStream()
171171
expect(channel).toBeInstanceOf(BuiltinTransformStream)
172172
})
173+
174+
test('exposes "WritableStream"', () => {
175+
expect(globalThis).toHaveProperty('WritableStream')
176+
const channel = new WritableStream()
177+
expect(channel).toBeInstanceOf(BuiltinWritableStream)
178+
})

0 commit comments

Comments
 (0)