Repository navigation
test: run tests outside src in the shared Vitest config - #10874
Merged
Merged
Conversation
cryptodev-2s
force-pushed
the
test/vitest-include-tests-dir
branch
from
October 20, 2026 23:21
2799423 to
c0b6fa4
Compare
cryptodev-2s
commented
Oct 20, 2026
|
|
||
| // The files to include in the test run. | ||
| include: ['src/**/*.test.ts'], | ||
| include: ['src/**/*.test.ts', 'tests/**/*.test.ts'], |
Contributor
Author
There was a problem hiding this comment.
we could also just use configDefaults from https://vitest.dev/config/include
Collaborator
There was a problem hiding this comment.
We could, but currently we are following the MetaMask unit testing guidelines, which say that unit tests are located next to source files.
Contributor
Author
There was a problem hiding this comment.
I see thanks, but we still need this PR because of some tests that are still under tests
mcmire
approved these changes
Oct 21, 2026
mcmire
left a comment
Collaborator
There was a problem hiding this comment.
I was going to suggest that we override this at the package-level vitest.config.packages.js. But I see now that we're just trying to replicate the existing Jest config. So this seems fine.
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
The shared Vitest config only includes
src/**/*.test.ts, but Jest's defaulttestMatchpicks up test files anywhere in a package. Seven packages still on Jest keep tests outsidesrc/, almost all of them in atests/directory, so migrating any of them would silently stop running those files while the suite still reported green.References
Checklist
no-changeloglabel.Note
Low Risk
Test-runner configuration only; no runtime or API behavior changes.
Overview
Expands the shared package Vitest
includeglob so suites match Jest-style layouts: tests undersrc/still run, andtests/**/*.test.tsis picked up without per-package overrides.This avoids silently dropping large
tests/suites when migrating packages from Jest (e.g.network-controller), where most coverage can live outsidesrc/. Packages already on Vitest with onlysrc/tests are unchanged; packages that intentionally ignoretests/(e.g.wallet-cli) can still exclude that path locally when they migrate.Reviewed by Cursor Bugbot for commit 2799423. Bugbot is set up for automated code reviews on this repo. Configure here.