chore(runtime): avoid magical null value#16160
Conversation
✅ Deploy Preview for jestjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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
nullreturns inEsmLoader.tryLoadGraphSyncand related helpers with a'load-async'sentinel union type. - Update
EsmLoaderunit 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. |
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
There was a problem hiding this comment.
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/',
Summary
Extracted from #16152
Test plan
Green CI