Skip to content

test: run subscription-controller on Vitest - #10555

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

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

Conversation

@cryptodev-2s

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

Copy link
Copy Markdown
Contributor

Explanation

Moves @metamask/subscription-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).

The jest.environment.cjs here only exposed crypto, which Node provides, so it is gone rather than ported.

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-only and tooling changes; production subscription-controller code is unchanged.

Overview
Migrates @metamask/subscription-controller from Jest to Vitest, aligning it with the shared package Vitest setup from the monorepo stack.

Test runner and config: Removes jest.config.cjs and the custom jest.environment.cjs (Web Crypto polyfill). Adds vitest.config.mjs with 100% coverage thresholds (same as the old Jest config). package.json test scripts now call vitest; Jest-related devDependencies are dropped in favor of vitest ^5.

Test code: All *.test.ts files import from vitest explicitly (globals off), replace jest.* with vi.*, use Vitest Mock types, and switch timer helpers to advanceTime from tests/vitest/helpers.ts. Package tsconfig.json sets "types": [] so repo-wide Jest types do not apply.

Repo wiring: @metamask/subscription-controller is removed from the Jest package list in test-runners.cjs. oxlint-suppressions.json is updated for the new lint profile (including vitest/no-conditional-in-test where needed).

Reviewed by Cursor Bugbot for commit 9f5da69. 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-phishing-controller branch from b64be55 to 8721c5d 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-phishing-controller branch from 8721c5d to 8b414fc 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-phishing-controller branch from 8b414fc to 807c7f5 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-phishing-controller branch from 807c7f5 to 356fffc 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-phishing-controller branch from 356fffc to 6027196 Compare October 5, 2026 10:48
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch from 6027196 to 77482d5 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-phishing-controller branch from 77482d5 to 72c543c Compare October 12, 2026 15:43
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 534eb2b to 4c40019 Compare October 12, 2026 15:43
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch from 72c543c to 041de24 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-subscription-controller branch from 4c40019 to fd50cd7 Compare October 14, 2026 09:24
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch from 041de24 to 464132b Compare October 14, 2026 12:47
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 2c5e08a to 4e68519 Compare October 14, 2026 12:53
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch 2 times, most recently from 1f1d11f to d6ffd65 Compare October 14, 2026 18:11
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 2ff098a to f352b76 Compare October 14, 2026 20:18
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch 2 times, most recently from d5ff385 to 8ebcdfa Compare October 14, 2026 20:37
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from f352b76 to 5e08c84 Compare October 14, 2026 20:37
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch from 8ebcdfa to 910c9b2 Compare October 14, 2026 20:59
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch 2 times, most recently from 9b4e972 to 2e9d2ec Compare October 14, 2026 21:27
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch 2 times, most recently from 10f6716 to f7ae283 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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f2a8dd. Configure here.

Comment thread oxlint-suppressions.json Outdated
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-phishing-controller branch from f7ae283 to 53d230f 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-phishing-controller branch from 53d230f to 8fd33d9 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-phishing-controller branch from 8fd33d9 to c27cc50 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-phishing-controller branch from c27cc50 to b2ad15e 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-phishing-controller branch from b2ad15e to 845a892 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-phishing-controller branch from 845a892 to f260b1e 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-phishing-controller to test/vitest-setup October 15, 2026 14:56
@cryptodev-2s
cryptodev-2s force-pushed the test/vitest-subscription-controller branch from 13fd51b to 9f5da69 Compare October 15, 2026 15:38

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