Repository navigation
Own the Jest setup so the tests survive @wordpress/scripts 36 - #666
Merged
Merged
Conversation
# Conflicts: # package-lock.json # package.json
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Update the Jest workflow’s Node version to one supported by @wordpress/scripts 36.
Review effort: Lite
Findings: 1
What changed in this PR
This PR makes Jest configuration project-owned so unit tests continue working with @wordpress/scripts 36.
Changes:
- Switches unit-test scripts to
test-unit-jest. - Adds direct Jest, Babel, and WordPress preset dependencies.
- Adds local Jest and Babel configuration.
| File | Description |
|---|---|
package.json |
Updates test scripts and development dependencies. |
package-lock.json |
Locks the Jest and Babel dependency tree. |
jest.config.js |
Configures the WordPress Jest preset and Babel transformation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Same fix as Automattic/wordpress-activitypub#3829.
@wordpress/scripts36 handstest-unit-jsto Vitest, so thejestjob on #661 exits without running any tests. The same release also dropsconfig/jest-unit.config.jsand the bundled Jest dependencies, so switching totest-unit-jestalone is not enough.This PR:
test:unitandtest:unit:watchtotest-unit-jestjest,jest-environment-jsdom,babel-jest,@babel/core,@wordpress/jest-preset-defaultand@wordpress/babel-preset-defaultas dev dependenciesjest.config.json@wordpress/jest-preset-defaultdirectly and configures Babel there, so it does not change the webpack buildThe lockfile diff is big, but it is mostly npm deduplicating nested Jest packages now that Jest is a direct dependency.
Testing
npm run test:unit: 3 suites, 47 tests pass@wordpress/scripts36 added temporarily (not saved to the manifest),npm run test:unitandnpm run buildpass as well