Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(expect): revert node: protocol imports to restore webpack/browser compatibility#16167

Merged
SimenB merged 2 commits into
jestjs:mainfrom
jon-zawada:fix/revert-node-protocol-browser-compat
May 12, 2026
Merged

fix(expect): revert node: protocol imports to restore webpack/browser compatibility#16167
SimenB merged 2 commits into
jestjs:mainfrom
jon-zawada:fix/revert-node-protocol-browser-compat

Conversation

@jon-zawada
Copy link
Copy Markdown
Contributor

@jon-zawada jon-zawada commented May 12, 2026

Summary

PR #16077 introduced the unicorn/prefer-node-protocol rule which changed bare specifiers (e.g. 'path') to use the node: prefix (e.g. 'node:path') across the codebase. While functionally identical in Node.js, the node: URI scheme is not recognized by webpack, breaking the expect package when used in browser-bundled environments like Cypress or Playwright.

This reverts the node: prefix in the packages that are transitive runtime dependencies of expect (jest-util, jest-message-util, jest-pattern, jest-regex-util), and disables the unicorn/prefer-node-protocol ESLint rule for those packages to prevent the regression from being reintroduced.

Fixes #16161

Test plan

  1. yarn build:js
  2. yarn jest packages/jest-util/src/tests/ packages/jest-message-util/ packages/jest-pattern/ packages/jest-regex-util/
  3. yarn eslint packages/jest-util/src/ packages/jest-message-util/src/ packages/jest-pattern/src/ packages/jest-regex-util/src/ eslint.config.mjs
  4. Confirmed no node: prefix remains in built output:
    grep -r "node:" packages/jest-util/build/ packages/jest-message-util/build/ packages/jest-pattern/build/ packages/jest-regex-util/build/ (no output)

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 12, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fafe556
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/6a029e619bdbd500097307d0
😎 Deploy Preview https://deploy-preview-16167--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jon-zawada
Copy link
Copy Markdown
Contributor Author

First time contributing let me know if I did not follow anything to your standards, signed the CLA waiting for it to update

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 12, 2026

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@16167

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@16167

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@16167

create-jest

npm i https://pkg.pr.new/create-jest@16167

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@16167

expect

npm i https://pkg.pr.new/expect@16167

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@16167

jest

npm i https://pkg.pr.new/jest@16167

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@16167

jest-circus

npm i https://pkg.pr.new/jest-circus@16167

jest-cli

npm i https://pkg.pr.new/jest-cli@16167

jest-config

npm i https://pkg.pr.new/jest-config@16167

@jest/console

npm i https://pkg.pr.new/@jest/console@16167

@jest/core

npm i https://pkg.pr.new/@jest/core@16167

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@16167

jest-diff

npm i https://pkg.pr.new/jest-diff@16167

jest-docblock

npm i https://pkg.pr.new/jest-docblock@16167

jest-each

npm i https://pkg.pr.new/jest-each@16167

@jest/environment

npm i https://pkg.pr.new/@jest/environment@16167

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@16167

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@16167

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@16167

@jest/expect

npm i https://pkg.pr.new/@jest/expect@16167

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@16167

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@16167

@jest/globals

npm i https://pkg.pr.new/@jest/globals@16167

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@16167

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@16167

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@16167

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@16167

jest-message-util

npm i https://pkg.pr.new/jest-message-util@16167

jest-mock

npm i https://pkg.pr.new/jest-mock@16167

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@16167

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@16167

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@16167

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@16167

jest-resolve

npm i https://pkg.pr.new/jest-resolve@16167

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@16167

jest-runner

npm i https://pkg.pr.new/jest-runner@16167

jest-runtime

npm i https://pkg.pr.new/jest-runtime@16167

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@16167

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@16167

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@16167

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@16167

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@16167

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@16167

@jest/transform

npm i https://pkg.pr.new/@jest/transform@16167

@jest/types

npm i https://pkg.pr.new/@jest/types@16167

jest-util

npm i https://pkg.pr.new/jest-util@16167

jest-validate

npm i https://pkg.pr.new/jest-validate@16167

jest-watcher

npm i https://pkg.pr.new/jest-watcher@16167

jest-worker

npm i https://pkg.pr.new/jest-worker@16167

pretty-format

npm i https://pkg.pr.new/pretty-format@16167

commit: fafe556

Copy link
Copy Markdown
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

I wonder if we should have a lint rule banning it in the packages we wanna keep universal?

This is fine for now, tho 🙂 Thanks!

@SimenB SimenB merged commit b9bb75f into jestjs:main May 12, 2026
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: expect standalone package broken in browser bundlers (Cypress/webpack) since 30.4.0 — node: URI scheme introduced by #16077

2 participants