test(perps): migrate controller unit tests to core#8840
Open
abretonc7s wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 ca157fb. Configure here.
michalconsensys
approved these changes
May 19, 2026
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
This PR migrates the mobile perps controller unit tests into
@metamask/perps-controllerso Core owns the controller test suite. It ports the mobile coverage into Core-nativetests/srcfiles, splits the largest controller/provider/subscription suites into focused shards, adds shared test helpers, and switches package coverage collection from the placeholder test to realsrc/**/*.tscoverage.The package now enforces at least 80% statement/line coverage for the perps controller package. This is test-only and does not change the published runtime API.
Validation performed:
yarn workspace @metamask/perps-controller run test --runInBandyarn eslint 'packages/perps-controller/{src,tests}/**/*.ts'yarn lint:misc --checkyarn workspace @metamask/perps-controller run changelog:validateKnown limitation:
yarn tsc --build packages/perps-controller/tsconfig.build.json --verboseis blocked by existing workspace dependency type errors outside this PR, first inaccounts-controller/snap-account-servicekeyring exports, so the perps package is skipped by project references.References
No related Core GitHub issue found for
perps controller tests core.Checklist
Note
Low Risk
Test-only changes that add/reshuffle Jest tests and adjust coverage collection/thresholds; main risk is CI friction from new coverage enforcement or brittle mocks, not runtime behavior.
Overview
Moves PerpsController unit tests into Core under
packages/perps-controller/tests, split into focused suites (configuration,lifecycle,operations) and backed by new shared mocks (providerMocks,serviceMocks) to standardize provider/messenger/infrastructure stubbing.Updates
jest.config.jsto collect coverage from realsrc/**/*.ts(excluding barrelindex.tsfiles) and relaxes/sets explicit global coverage thresholds (70% branches, 78% functions, 80% lines/statements) instead of the prior placeholder-only coverage setup.Reviewed by Cursor Bugbot for commit ca157fb. Bugbot is set up for automated code reviews on this repo. Configure here.