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

Skip to content

chore(runtime): avoid magical null value#16160

Merged
SimenB merged 7 commits into
jestjs:mainfrom
SimenB:no-magic-null
May 11, 2026
Merged

chore(runtime): avoid magical null value#16160
SimenB merged 7 commits into
jestjs:mainfrom
SimenB:no-magic-null

Conversation

@SimenB
Copy link
Copy Markdown
Member

@SimenB SimenB commented May 11, 2026

Summary

Extracted from #16152

Test plan

Green CI

Copilot AI review requested due to automatic review settings May 11, 2026 06:58
@netlify
Copy link
Copy Markdown

netlify Bot commented May 11, 2026

Deploy Preview for jestjs ready!

Name Link
🔨 Latest commit e0d7538
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/6a01861f9a0271000861b37b
😎 Deploy Preview https://deploy-preview-16160--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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors jest-runtime’s ESM sync-graph loader to avoid using null as an implicit “fall back to async” sentinel, replacing it with an explicit 'load-async' sentinel value and updating the associated unit tests and housekeeping files.

Changes:

  • Replace null returns in EsmLoader.tryLoadGraphSync and related helpers with a 'load-async' sentinel union type.
  • Update EsmLoader unit tests to assert on 'load-async' and adjust sync/async fallback checks.
  • Add gitignore / cleanup-script exceptions and a changelog entry for the change.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/cleanE2e.mjs Excludes an additional e2e fixture node_modules directory from the cleanup script.
packages/jest-runtime/src/internals/EsmLoader.ts Introduces a 'load-async' sentinel return value for sync-graph loading and propagates it through sync-graph helpers/callers.
packages/jest-runtime/src/internals/tests/EsmLoader.test.ts Updates expectations to the new sentinel and adjusts assertions for the widened return type.
CHANGELOG.md Adds a Chore & Maintenance entry describing the change.
.gitignore Un-ignores additional fixture node_modules directories needed by tests/fixtures.

Comment thread CHANGELOG.md
Comment thread packages/jest-runtime/src/internals/EsmLoader.ts Outdated
Comment thread packages/jest-runtime/src/internals/EsmLoader.ts
Comment thread packages/jest-runtime/src/internals/__tests__/EsmLoader.test.ts Outdated
Comment thread packages/jest-runtime/src/internals/__tests__/EsmLoader.test.ts Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

Open in StackBlitz

babel-jest

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

babel-plugin-jest-hoist

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

babel-preset-jest

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

create-jest

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

@jest/diff-sequences

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

expect

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

@jest/expect-utils

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

jest

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

jest-changed-files

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

jest-circus

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

jest-cli

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

jest-config

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

@jest/console

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

@jest/core

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

@jest/create-cache-key-function

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

jest-diff

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

jest-docblock

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

jest-each

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

@jest/environment

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

jest-environment-jsdom

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

@jest/environment-jsdom-abstract

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

jest-environment-node

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

@jest/expect

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

@jest/fake-timers

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

@jest/get-type

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

@jest/globals

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

jest-haste-map

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

jest-jasmine2

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

jest-leak-detector

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

jest-matcher-utils

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

jest-message-util

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

jest-mock

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

@jest/pattern

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

jest-phabricator

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

jest-regex-util

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

@jest/reporters

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

jest-resolve

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

jest-resolve-dependencies

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

jest-runner

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

jest-runtime

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

@jest/schemas

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

jest-snapshot

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

@jest/snapshot-utils

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

@jest/source-map

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

@jest/test-result

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

@jest/test-sequencer

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

@jest/transform

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

@jest/types

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

jest-util

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

jest-validate

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

jest-watcher

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

jest-worker

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

pretty-format

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

commit: e0d7538

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

scripts/cleanE2e.mjs:21

  • The excludedModules list includes e2e/native-esm-js-esm-syntax-fallback/node_modules/, but that fixture directory doesn’t exist in this PR’s tree. This entry is currently dead configuration and makes the clean script harder to reason about; either add the fixture (if intended) or drop this exclusion.
  'e2e/presets/json/node_modules/',
  'e2e/presets/mjs/node_modules/',
  'e2e/resolve-conditions/node_modules/',

@SimenB SimenB merged commit 01676a3 into jestjs:main May 11, 2026
89 of 90 checks passed
@SimenB SimenB deleted the no-magic-null branch May 11, 2026 07:42
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.

2 participants