Skip to content

fix(jest-runtime): don't force the node export condition for require() in jsdom - #16490

Open
Kesavamoorthig06 wants to merge 1 commit into
jestjs:mainfrom
Kesavamoorthig06:fix-cjs-node-condition
Open

Kesavamoorthig06 wants to merge 1 commit into
jestjs:mainfrom
Kesavamoorthig06:fix-cjs-node-condition

Conversation

@Kesavamoorthig06

Copy link
Copy Markdown

Summary

Fixes #16476.

require() always got the node export condition, even in jest-environment-jsdom, so a package that lists node before browser resolved to its Node entry under jsdom and customExportConditions couldn't change that. Jest 29 didn't do this.

Now node is only added when the environment doesn't provide exportConditions() at all (that's the case #15647 was covering). The node environment still supplies node, jsdom supplies browser.

Test plan

Added unit tests for Resolution and two e2e tests (jsdom and node) against a package with node listed first. The jsdom one fails on main. The jest-runtime, jest-resolve and jest-environment unit suites and the e2e resolve suites pass locally.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

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

  • ✅ login: Kesavamoorthig06 / name: KESAVAMOORTHI GOVINDHARAJ (140f666)

@netlify

netlify Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for jestjs ready!

Built without sensitive environment variables

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

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@github-actions github-actions Bot added the require-changelog If a PR does requires a changelog entry label Oct 11, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

babel-jest

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

babel-plugin-jest-hoist

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

babel-preset-jest

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

create-jest

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

@jest/diff-sequences

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

expect

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

@jest/expect-utils

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

jest

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

jest-changed-files

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

jest-circus

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

jest-cli

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

jest-config

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

@jest/console

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

@jest/core

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

@jest/create-cache-key-function

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

jest-diff

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

jest-docblock

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

jest-each

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

@jest/environment

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

jest-environment-jsdom

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

@jest/environment-jsdom-abstract

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

jest-environment-node

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

@jest/expect

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

@jest/fake-timers

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

@jest/get-type

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

@jest/globals

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

jest-haste-map

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

jest-jasmine2

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

jest-leak-detector

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

jest-matcher-utils

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

jest-message-util

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

jest-mock

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

@jest/pattern

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

jest-phabricator

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

jest-regex-util

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

@jest/reporters

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

jest-resolve

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

jest-resolve-dependencies

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

jest-runner

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

jest-runtime

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

@jest/schemas

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

jest-snapshot

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

@jest/snapshot-utils

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

@jest/source-map

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

@jest/test-result

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

@jest/test-sequencer

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

@jest/transform

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

@jest/types

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

jest-util

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

jest-validate

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

jest-watcher

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

jest-worker

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

pretty-format

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

commit: 140f666

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

require-changelog If a PR does requires a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: require() applies the node export condition in the jsdom environment

1 participant