Skip to content

test: run network-controller on Vitest - #10873

Open
cryptodev-2s wants to merge 2 commits into
mainfrom
test/vitest-network-controller
Open

cryptodev-2s wants to merge 2 commits into
mainfrom
test/vitest-network-controller

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Moves @metamask/network-controller to Vitest.

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
    • Not applicable, test only change. Carries the no-changelog label.
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
    • None.

Note

Low Risk
Test and tooling migration only; production network-controller runtime code is unchanged aside from lint-suppression bookkeeping.

Overview
Migrates @metamask/network-controller from Jest (+ TSTyche) to Vitest as part of the broader test-runner migration.

The package drops jest.config.cjs and Jest-related devDependencies; package.json scripts now call vitest, with a merged vitest.config.js that adds tests/**/*.test.ts (large NetworkController suites outside src/), enables typecheck for *.test-d.ts (TSTyche → expectTypeOf().toExtend()), and sets Vitest coverage thresholds.

Test code is mechanically updated (jest → vi, fake timers, mocks). Notable fixes beyond rename: waitForPromiseToBeFulfilledAfterRunningAllTimers yields a real macrotask before vi.runAllTimersAsync so nock replies settle; onBreak expectations use HttpError(503) instead of generic Error; ignoreRejection lives in tests/vitest/helpers.ts; Jest-only jest-when removed; jsdom test environment removed (node passes). The package is removed from the Jest test-runner-package-map.

Reviewed by Cursor Bugbot for commit ffac03d. Bugbot is set up for automated code reviews on this repo. Configure here.

This branch was successfully deployed

1 active deployment
default-branch — ffac03d1 Deployed Oct 16, 2026 by cryptodev-2s via Determine whether this PR is a release PR #5619
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.

1 participant