Repository navigation
test: run network-controller on Vitest - #10873
Merged
Merged
Conversation
2 of 4 tasks
cryptodev-2s
marked this pull request as draft
October 20, 2026 14:59
cryptodev-2s
marked this pull request as ready for review
October 22, 2026 13:18
cryptodev-2s
commented
Oct 22, 2026
| expect(onBreakListener).toHaveBeenCalledTimes(1); | ||
| expect(onBreakListener).toHaveBeenCalledWith({ | ||
| error: new Error("Fetch failed with status '503'"), | ||
| error: new HttpError(503), |
Contributor
Author
There was a problem hiding this comment.
The listener receives an HttpError with an httpStatus property. Jest compared errors by message, so the previous new Error(...) expectation passed. Vitest also compares additional error properties, so we use new HttpError(503) to match the actual callback payload.
cryptodev-2s
commented
Oct 22, 2026
| name: basename(dirname(fileURLToPath(import.meta.url))), | ||
|
|
||
| typecheck: { | ||
| ignoreSourceErrors: true, |
Contributor
Author
There was a problem hiding this comment.
Source checking is handled by lint:tsc:check. This suppresses Vitest’s source diagnostics, including unbuilt project references; .test-d.ts failures still fail the test run.
cryptodev-2s
added this pull request to stack #11032
October 23, 2026 09:41
2 of 4 tasks
cryptodev-2s
force-pushed
the
test/vitest-network-controller
branch
from
October 23, 2026 17:17
84e8630 to
7e05b77
Compare
cryptodev-2s
enabled stacked auto-merge
October 23, 2026 17:46
cryptodev-2s
commented
Oct 23, 2026
| jest.spyOn(Date, 'now').mockReturnValue(FAKE_DATE_NOW_MS); | ||
| }); | ||
|
|
||
| afterEach(() => { |
Contributor
Author
There was a problem hiding this comment.
was needed for jest-when
cryptodev-2s
force-pushed
the
test/vitest-network-controller
branch
from
October 23, 2026 20:06
b849522 to
5b0ead4
Compare
Move conditional-test lint exceptions to bulk suppressions, remove redundant constructor-type comments, and drop unused jest-when from the lockfile. Retain the real timer yield: replacing it with flushPromises made the existing 502-retry test time out.
Move conditional expectations to bulk suppressions, remove obsolete disable directives, and drop the timer explanation while retaining the timer yield.
Replace duplicated Constructable aliases with the exported @vitest/spy type and declare the existing 5.0.3 version as a direct development dependency.
Use the package naming pattern shared by other Vitest configs and remove redundant configuration comments and the unnecessary lint directive.
Drop the unused TSTyche entry after rebasing the Vitest migration onto current main.
All shared-helper consumers now use Vitest. Restore the original helper structure with vi.fn defaults and the Vitest Mock type, removing the obsolete captureException option and caller overrides.
Refresh the generated lockfile after migrating the final Jest workspace, without changing remaining dependency versions or the test-runner map interface.
cryptodev-2s
force-pushed
the
test/vitest-network-controller
branch
from
October 23, 2026 21:23
1aa7a99 to
31a5fd0
Compare
mcmire
approved these changes
Oct 23, 2026
| expect(onBreakListener).toHaveBeenCalledTimes(1); | ||
| expect(onBreakListener).toHaveBeenCalledWith({ | ||
| error: new Error("Fetch failed with status '503'"), | ||
| error: new HttpError(503), |
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
Moves
@metamask/network-controllerto Vitest, including runtime and type tests.With the final Jest workspace migrated, removes the remaining shared Jest configuration, setup files, helpers, typings, and direct dependencies. Cleans up lint configuration, build exclusions, CODEOWNERS generation, and testing documentation.
References
Checklist
no-changeloglabel.Note
Medium Risk
Large test-runner swap for network-controller (RPC failover, provider, and extensive network-client coverage); production code changes are minimal (mostly test env lint tweaks), but CI signal depends on Vitest parity with the removed Jest setup.
Overview
Completes the monorepo move from Jest to Vitest by migrating
@metamask/network-controller—the last Jest workspace—including unit tests, shared network-client suites, and struct type checks (tstyche→vitestexpectTypeOf). Tests now usevifor mocks, timers, and spies; package scripts runvitestinstead of Jest/jest-silent-reporter, and the packagejest.config.cjsis removed in favor ofvitest.config.ts.With no Jest packages left, this PR removes shared Jest infrastructure: root
jest.config.packages.cjs, Jest from rootpackage.jsonand LavaMoat allow-scripts, Jest-specific oxlint rules andtest-runner-package-map, andjest.config.*entries from CODEOWNERS and CI path ignores. AGENTS.md, testing, and package migration docs now describe Vitest-only workflows; assorted tests only updateeslint-disablecomments fromjest/*tovitest/*.Reviewed by Cursor Bugbot for commit 1aa7a99. Bugbot is set up for automated code reviews on this repo. Configure here.