chore: migrate Jest from v27 to v29#7894
Merged
cryptodev-2s merged 62 commits intomainfrom Feb 11, 2026
Merged
Conversation
Update Jest related packages to ^28. This resolves a peer dependency warning from `ts-jest` about the version of `typescript` we're using being too high. Here are the relevant changelogs: * `ts-jest`: https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md#2800-2022-05-02 * None of the breaking changes impacted us here * `jest`: https://github.com/jestjs/jest/releases/tag/v28.0.0 * Blog post: https://jestjs.io/blog/2022/04/25/jest-28 * Migration guide: https://jest-archive-august-2023.netlify.app/docs/28.x/upgrading-to-jest28/
- Clear native fetch in Node.js 18+ before importing isomorphic-fetch - This ensures isomorphic-fetch uses node-fetch (which nock can intercept) instead of native fetch (which uses undici and nock cannot intercept) - Simplify nock cleanup by removing redundant afterAll hook - Fixes 'TypeError: fetch failed' errors in tests with nock mocks
- Add 'export {};' at top of file to satisfy import-x/unambiguous lint rule
- Fixes 'This module could be parsed as a valid script' error
- Remove eslint suppressions for nock.ts (no longer needed)
- Adjust coverage thresholds in bridge-status-controller (lines/statements: 100 -> 99)
- Format jest.useFakeTimers({}) calls consistently
- Reorder imports in TestStrategy.test.ts
- Add resolution override to force ^5.0.0 to use ^5.0.1 - Fixes invalid resolution error when @metamask/eth-json-rpc-infura depends on ^5.0.0 while root package.json specifies ^5.0.1 - Update yarn.lock to reflect the resolution change
…tibility # Conflicts: # eslint-suppressions.json # package.json # packages/account-tree-controller/package.json # packages/accounts-controller/package.json # packages/address-book-controller/package.json # packages/analytics-controller/package.json # packages/announcement-controller/package.json # packages/app-metadata-controller/package.json # packages/approval-controller/package.json # packages/assets-controllers/package.json # packages/base-controller/package.json # packages/bridge-controller/package.json # packages/bridge-status-controller/jest.config.js # packages/bridge-status-controller/package.json # packages/build-utils/package.json # packages/chain-agnostic-permission/package.json # packages/claims-controller/package.json # packages/composable-controller/package.json # packages/controller-utils/package.json # packages/core-backend/package.json # packages/delegation-controller/package.json # packages/earn-controller/package.json # packages/eip-5792-middleware/package.json # packages/eip-7702-internal-rpc-middleware/package.json # packages/eip1193-permission-middleware/package.json # packages/ens-controller/package.json # packages/error-reporting-service/package.json # packages/eth-block-tracker/package.json # packages/eth-json-rpc-middleware/package.json # packages/eth-json-rpc-provider/package.json # packages/foundryup/package.json # packages/gas-fee-controller/package.json # packages/gator-permissions-controller/package.json # packages/json-rpc-engine/package.json # packages/json-rpc-middleware-stream/package.json # packages/keyring-controller/package.json # packages/logging-controller/package.json # packages/message-manager/package.json # packages/messenger/package.json # packages/multichain-account-service/package.json # packages/multichain-api-middleware/package.json # packages/multichain-network-controller/package.json # packages/multichain-transactions-controller/package.json # packages/name-controller/package.json # packages/network-controller/package.json # packages/network-enablement-controller/package.json # packages/notification-services-controller/package.json # packages/permission-controller/package.json # packages/permission-log-controller/package.json # packages/permission-log-controller/tests/PermissionLogController.test.ts # packages/phishing-controller/package.json # packages/polling-controller/package.json # packages/preferences-controller/package.json # packages/profile-sync-controller/package.json # packages/ramps-controller/package.json # packages/rate-limit-controller/package.json # packages/remote-feature-flag-controller/package.json # packages/sample-controllers/package.json # packages/seedless-onboarding-controller/package.json # packages/selected-network-controller/package.json # packages/shield-controller/package.json # packages/signature-controller/package.json # packages/subscription-controller/package.json # packages/transaction-controller/package.json # packages/transaction-pay-controller/package.json # packages/user-operation-controller/package.json # tests/setup.ts # tests/setupAfterEnv/nock.ts # yarn.lock
- Update jest-environment-jsdom to ^29.0.0 for Jest 28 compatibility
- Update jest.environment.js files to use correct import syntax for v29:
- JSDOMEnvironment = require('jest-environment-jsdom').default
- NodeEnvironment = require('jest-environment-node').default
- Add jest-environment-jsdom to packages using testEnvironment: 'jsdom'
- Configure ts-jest with isolatedModules and diagnostics:false to skip
type checking during tests (should be done separately via build:types)
Affected packages:
- assets-controllers
- bridge-controller
- bridge-status-controller
- controller-utils
- core-backend
- keyring-controller
- network-controller
- notification-services-controller
- profile-sync-controller
- seedless-onboarding-controller
- selected-network-controller
- transaction-controller
- Add uuid to root devDependencies to fix n/no-extraneous-require error - Add import-x/no-unassigned-import disable comment for isomorphic-fetch require
Update packages that were missed during merge conflict resolution: - ai-controllers - analytics-data-regulation-controller - assets-controller - connectivity-controller - perps-controller - profile-metrics-controller - storage-service All packages now use: - @types/jest: ^28.0.0 - jest: ^28.0.0 - ts-jest: ^28.0.0
Update fake timers syntax from jest.useFakeTimers('modern') to
jest.useFakeTimers() for Jest 28 compatibility.
…lity Fix fake timers usage in threshold cache cleanup test. The test was calling jest.useFakeTimers() mid-test after async operations completed with real timers, causing inconsistent Date.now() behavior. Updated to use fake timers from the start of the test and jest.setSystemTime() to control time advancement.
Change from .default import to named { TestEnvironment } import
for jest-environment-jsdom in custom test environments.
- jest: ^28.0.0 → ^28.1.3 - ts-jest: ^28.0.0 → ^28.0.8 - @types/jest: ^28.0.0 → ^28.1.8
ESLint runs out of memory on large monorepos. Increase heap to 8GB.
infiniteflower
approved these changes
Feb 10, 2026
gambinish
approved these changes
Feb 10, 2026
vinnyhoward
approved these changes
Feb 10, 2026
Matt561
approved these changes
Feb 10, 2026
jeffsmale90
approved these changes
Feb 10, 2026
Contributor
jeffsmale90
left a comment
There was a problem hiding this comment.
Changes to GatorPermissionsController look good to me!
HowardBraham
approved these changes
Feb 10, 2026
jiexi
approved these changes
Feb 10, 2026
tommasini
approved these changes
Feb 10, 2026
imblue-dabadee
approved these changes
Feb 10, 2026
OGPoyraz
approved these changes
Feb 10, 2026
Bigshmow
approved these changes
Feb 10, 2026
lwin-kyaw
approved these changes
Feb 11, 2026
cryptodev-2s
added a commit
that referenced
this pull request
Feb 11, 2026
Missed updating the create-package template during the Jest v27 to v29 migration (#7894).
4 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 11, 2026
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Missed updating the create-package template during the Jest v27 to v29 migration (#7894). ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Dependency-only update confined to the create-package template; risk is limited to newly generated packages’ test setup compatibility. > > **Overview** > Updates the `scripts/create-package/package-template/package.json` devDependencies to Jest v29 by bumping `jest`, `ts-jest`, and `@types/jest` versions so new packages created from the template default to the newer test stack. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fc17f96. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
Explanation
References
Checklist
Note
Medium Risk
Moderate risk because it upgrades core test runner dependencies and changes transforms/environments, which can cause widespread CI failures or subtle test behavior differences despite being mostly config/snapshot churn.
Overview
Upgrades the monorepo’s test tooling from Jest v27 to v29 (and aligns
@types/jest,ts-jest, andjest-environment-jsdomversions across packages), removing now-unneeded Babel test plumbing (dropsbabel.config.jsandbabel-jest).Updates Jest configuration to run TypeScript tests via
ts-jest(including scripts) and adds targetedmoduleNameMapperfixes like resolvinguuidexplicitly; also updates the custom JSDOM environment to use the v29TestEnvironmentexport.Regenerates/updates numerous inline snapshots and
.snapfiles to match Jest v29’s snapshot formatting output changes.Written by Cursor Bugbot for commit 9082f5a. This will update automatically on new commits. Configure here.