Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: update msw to 2.5.0#17124

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
sreya wants to merge2 commits intomainfromjon/msw
Closed

chore: update msw to 2.5.0#17124

sreya wants to merge2 commits intomainfromjon/msw

Conversation

sreya
Copy link
Collaborator

@sreyasreya commentedMar 27, 2025
edited by jaaydenh
Loading

  • Fixes a transitive High severity dependency in path-to-regexp

TLDR:
The solution is to either:

  1. set testEnvironment: 'node' in the Jest config
  2. Polyfill the Web Streams API in JSDOM

option 1 is not possible because the current tests require access top the DOM

AI explanation of issue:

What changed between versions 2.3.5 and 2.5.0 that might cause TransformStream errors in Jest?

Several changes shipped in MSW’s version 2.5.x. One of the notable changes was more thorough usage of the Web Streams API (which includes classes like TransformStream). The Web Streams API is natively available in modern browsers and in newer versions of Node.js (≥ 18). In older environments (or certain test runners), the TransformStream global may not exist by default, leading to the error:

ReferenceError: TransformStream is not defined

Why does this happen in Jest?
•Jest’s default test environment (which is often jest-environment-jsdom) may not include the TransformStream global.
•If you’re using an older version of Node.js (like Node 14 or 16) along with Jest, you may also be missing the global Web Streams classes.

As of MSW 2.5.x, the library expects TransformStream (and possibly other parts of the Web Streams API) to be present. If it’s not, you’ll see the ReferenceError.

Even though you’re on Node 20 (which natively supports the Web Streams API), you can still get ReferenceError: TransformStream is not defined if your test environment (usually JSDOM in Jest) doesn’t expose the TransformStream global. In other words, Node itself may have TransformStream, but JSDOM (or another test environment) might not.

- Fixes a transitive High severity dependency in path-to-regexp
@sreyasreya changed the titlechore: update msw to 2.3.5chore: update msw to 2.5.0Mar 27, 2025
Copy link
Contributor

@jaaydenhjaaydenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good and seems like the only available solution at the moment.

I added some context around what the problem is and why this solution is the correct one.

@jaaydenhjaaydenh self-requested a reviewMarch 27, 2025 13:10
@jaaydenh
Copy link
Contributor

Looks like I approved too soon as this doesn't resolve be able to run the tests.

@BrunoQuaresma
Copy link
Collaborator

Closing in favor of#17135

BrunoQuaresma added a commit that referenced this pull requestMar 27, 2025
Fixes a transitive High severity dependency in path-to-regexp. We've tried to [upgrade to2.5.0](#17124) (currently, the latestversion) but there are some known bugs related to polyfills as [thisone](mswjs/msw#2288). As shared in thecomments, the latest version without this issue is 2.4.3.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jaaydenhjaaydenhAwaiting requested review from jaaydenh

Assignees

@sreyasreya

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sreya@jaaydenh@BrunoQuaresma

[8]ページ先頭

©2009-2025 Movatter.jp