-
Notifications
You must be signed in to change notification settings - Fork 9
fix: add TransformStream
#20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c33d617 to
2da3de6
Compare
2da3de6 to
808e8ff
Compare
|
While we wait for this PR to be merged, I managed to solve the issue using the // jest.setup.ts
import { TransformStream } from "web-streams-polyfill";
global.TransformStream = TransformStream; |
|
Thanks @ghernandez345, hope it gets merged. :) Thanks @ilbertt: I did the same but without the need to install a polyfill: import { TransformStream } from 'node:stream/web';(seen in mswjs/msw#1934 (reply in thread)) |
index.test.js
Outdated
| test('exposes "TransformStream"', () => { | ||
| expect(globalThis).toHaveProperty('TransformStream') | ||
| const channel = new TransformStream() | ||
| expect(channel).toBeInstanceOf(TransformStream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance comparison, we need to make sure it's the instance of Node's TransformStream. For that, it's a good idea to import this class directly from node:stream/web, I believe.
I can add this fix.
|
I think we are reaching the point of this package where we may as well re-set all the builtin modules on the global scope. Need to raise this as a separate issue. |
kettanaito
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you, @ghernandez345!
Released: v0.0.8 🎉This has been released in v0.0.8! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
When trying to upgrade to msw v2 I ran into an issue with the
TransformStreamglobal being undefined:Adding this locally fixed the issue so wanted to add it into the
jest-fixed-dompackage.