Skip to content

Conversation

@cryptodev-2s
Copy link
Contributor

@cryptodev-2s cryptodev-2s commented Feb 10, 2026

Explanation

References

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

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, and jest-environment-jsdom versions across packages), removing now-unneeded Babel test plumbing (drops babel.config.js and babel-jest).

Updates Jest configuration to run TypeScript tests via ts-jest (including scripts) and adds targeted moduleNameMapper fixes like resolving uuid explicitly; also updates the custom JSDOM environment to use the v29 TestEnvironment export.

Regenerates/updates numerous inline snapshots and .snap files 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.

Gudahtt and others added 30 commits November 19, 2025 17:04
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.
@cryptodev-2s cryptodev-2s requested a review from mcmire February 10, 2026 21:13
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

One more thing!

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@amitabh94 amitabh94 left a comment

Choose a reason for hiding this comment

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

Approving for Ramps

Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

Changes to GatorPermissionsController look good to me!

Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

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

Approved for Accounts CO

@cryptodev-2s cryptodev-2s added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit 00517c1 Feb 11, 2026
302 checks passed
@cryptodev-2s cryptodev-2s deleted the chore/migrate-jest-to-v29 branch February 11, 2026 01:43
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).
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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.