Skip to content

test: run user-operation-controller on Vitest - #10556

Open
cryptodev-2s wants to merge 1 commit into
test/vitest-setupfrom
test/vitest-user-operation-controller
Open

cryptodev-2s wants to merge 1 commit into
test/vitest-setupfrom
test/vitest-user-operation-controller

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Moves @metamask/user-operation-controller to Vitest. One of a stack on top of #10546, which added Vitest without migrating anything.

Add vitest.config.mts, delete jest.config.cjs, swap the test scripts and dev dependencies, point the package tsconfig off the repo wide types: ["jest"], and rewrite the test files (jest.* to vi.*, jest.Mocked to the imported Vitest type, requireActual to an awaited importActual, and an explicit vitest import per file since globals is off).

Four mocked constructors needed mockImplementation(function () { ... }): Vitest refuses mockReturnValue on a mock called with new. Those four sites caused 84 failures, so the diff reads worse than it is. Coverage thresholds restated at measured values. Istanbul on esbuild output counts statements slightly differently from babel on ts-jest output, within about a point.

Tests pass with coverage thresholds enforced. yarn lint and yarn constraints are green on this branch alone.

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 changes only; production source under src/ is not modified in this diff.

Overview
Migrates @metamask/user-operation-controller from Jest to Vitest, aligning it with the repo’s shared Vitest package setup.

Removes jest.config.cjs and Jest-related devDependencies/scripts; adds vitest.config.mjs (merged from vitest.config.packages.mjs) with coverage thresholds retuned for Vitest/Istanbul. Package tsconfig.json clears types so Jest globals are not pulled in. Test files now import Vitest explicitly and use vi.* instead of jest.*, including async importActual for partial mocks and mockImplementation on constructor mocks where Vitest disallows mockReturnValue with new.

@metamask/user-operation-controller is dropped from test-runners.cjs’s Jest package list; oxlint-suppressions.json is trimmed for removed Jest-only lint entries.

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

@cryptodev-2s
cryptodev-2s requested review from a team as code owners September 28, 2026 20:19
@cryptodev-2s
cryptodev-2s added this pull request to stack #10557 September 28, 2026 20:19
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 050fa68 to c972b23 Compare September 29, 2026 08:11
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 4949720 to 4a6a4a2 Compare September 29, 2026 08:11
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from c972b23 to 8fa7689 Compare September 29, 2026 09:02
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 4a6a4a2 to 8a4ccb8 Compare September 29, 2026 09:02
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 8fa7689 to 2a0668f Compare September 29, 2026 14:38
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 8a4ccb8 to 4204cd4 Compare September 29, 2026 14:38
@cryptodev-2s
cryptodev-2s removed this pull request from stack #10557 September 29, 2026 14:40
@cryptodev-2s
cryptodev-2s added this pull request to stack #10578 September 29, 2026 14:41
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 2a0668f to e64ca0a Compare September 30, 2026 07:04
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 082d1f4 to 8421df4 Compare October 5, 2026 10:48
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from e64ca0a to 7995d60 Compare October 5, 2026 10:48
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 7995d60 to e59fba9 Compare October 12, 2026 14:02
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 8421df4 to 534eb2b Compare October 12, 2026 14:02
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from e59fba9 to b76e8f3 Compare October 12, 2026 15:43
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 4c40019 to fd50cd7 Compare October 14, 2026 09:24
@cryptodev-2s
cryptodev-2s requested review from a team as code owners October 14, 2026 09:24
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from b76e8f3 to 146d5a8 Compare October 14, 2026 09:24
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from fd50cd7 to 2c5e08a Compare October 14, 2026 12:47
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch 2 times, most recently from 6d64a0f to e4ce20d Compare October 14, 2026 12:53
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 3923bce to 2ff098a Compare October 14, 2026 18:11
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 59ca90f to 005866c Compare October 14, 2026 18:11
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 2ff098a to f352b76 Compare October 14, 2026 20:18
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch 2 times, most recently from 1c37712 to 95c4b34 Compare October 14, 2026 20:37
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 5e08c84 to 9b4e972 Compare October 14, 2026 20:59
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 95c4b34 to c700fc6 Compare October 14, 2026 20:59
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 9b4e972 to 2e9d2ec Compare October 14, 2026 21:27
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch 2 times, most recently from 1d883b0 to c597d15 Compare October 14, 2026 22:48
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 2e9d2ec to 3f2a8dd Compare October 14, 2026 22:48
@cryptodev-2s
cryptodev-2s removed this pull request from stack #10578 October 14, 2026 22:51
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from c597d15 to ea0c4d8 Compare October 15, 2026 10:36
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 3f2a8dd to 5cbd6b0 Compare October 15, 2026 10:36
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from ea0c4d8 to 5ebe6f4 Compare October 15, 2026 11:20
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 5cbd6b0 to 54e7d4c Compare October 15, 2026 11:20
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 5ebe6f4 to 1603f69 Compare October 15, 2026 11:50
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 54e7d4c to 2837724 Compare October 15, 2026 11:50
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 1603f69 to f0e57e8 Compare October 15, 2026 12:20
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 2837724 to cffacfe Compare October 15, 2026 12:20
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from f0e57e8 to 75ebf14 Compare October 15, 2026 13:21
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from cffacfe to 0a7eb9a Compare October 15, 2026 13:21
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from 75ebf14 to d9c24b6 Compare October 15, 2026 14:48
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 0a7eb9a to 13fd51b Compare October 15, 2026 14:48
@cryptodev-2s
cryptodev-2s changed the base branch from test/vitest-subscription-controller to test/vitest-setup October 15, 2026 14:55
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from d9c24b6 to ca5d120 Compare October 15, 2026 15:38
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-user-operation-controller branch from ca5d120 to f0e0ea2 Compare October 15, 2026 20:08

This branch has not been deployed

No deployments
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