diff --git a/README.md b/README.md index 0576884..1480c7c 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ This project "fixes" the following global APIs, overriding whichever polyfills t - `URLSearchParams` - `BroadcastChannel` - `TransformStream` +- `WritableStream` ## Getting started diff --git a/index.js b/index.js index ef45e04..ac8033b 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,7 @@ class FixedJSDOMEnvironment extends JSDOMEnvironment { this.global.BroadcastChannel = BroadcastChannel this.global.TransformStream = TransformStream + this.global.WritableStream = WritableStream } } diff --git a/index.test.js b/index.test.js index 2d48f46..03a1fda 100644 --- a/index.test.js +++ b/index.test.js @@ -2,7 +2,7 @@ const { URL: BuiltinURL } = require('node:url') const { BroadcastChannel: BuiltinBroadcastChannel, } = require('node:worker_threads') -const { TransformStream: BuiltinTransformStream } = require('node:stream/web') +const { TransformStream: BuiltinTransformStream, WritableStream: BuiltinWritableStream } = require('node:stream/web') test('exposes "Blob"', async () => { expect(globalThis).toHaveProperty('Blob') @@ -170,3 +170,9 @@ test('exposes "TransformStream"', () => { const channel = new TransformStream() expect(channel).toBeInstanceOf(BuiltinTransformStream) }) + +test('exposes "WritableStream"', () => { + expect(globalThis).toHaveProperty('WritableStream') + const channel = new WritableStream() + expect(channel).toBeInstanceOf(BuiltinWritableStream) +})