Skip to content

Commit 87ea373

Browse files
fix: add TransformStream (#20)
Co-authored-by: Artem Zakharchenko <[email protected]>
1 parent a65ea67 commit 87ea373

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ This project "fixes" the following global APIs, overriding whichever polyfills t
4343
- `URL`
4444
- `URLSearchParams`
4545
- `BroadcastChannel`
46+
- `TransformStream`
4647

4748
## Getting started
4849

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class FixedJSDOMEnvironment extends JSDOMEnvironment {
2121
this.global.URLSearchParams = URLSearchParams
2222

2323
this.global.BroadcastChannel = BroadcastChannel
24+
this.global.TransformStream = TransformStream
2425
}
2526
}
2627

index.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +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')
56

67
test('exposes "Blob"', async () => {
78
expect(globalThis).toHaveProperty('Blob')
@@ -163,3 +164,9 @@ test('exposes "BroadcastChannel"', () => {
163164
expect(channel).toBeInstanceOf(BuiltinBroadcastChannel)
164165
channel.unref()
165166
})
167+
168+
test('exposes "TransformStream"', () => {
169+
expect(globalThis).toHaveProperty('TransformStream')
170+
const channel = new TransformStream()
171+
expect(channel).toBeInstanceOf(BuiltinTransformStream)
172+
})

0 commit comments

Comments
 (0)