Skip to content

test: run tests outside src in the shared Vitest config - #10874

Open
cryptodev-2s wants to merge 1 commit into
mainfrom
test/vitest-include-tests-dir
Open

cryptodev-2s wants to merge 1 commit into
mainfrom
test/vitest-include-tests-dir

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

The shared Vitest config only includes src/**/*.test.ts, but Jest's default testMatch picks up test files anywhere in a package. Seven packages still on Jest keep tests outside src/, almost all of them in a tests/ directory, so migrating any of them would silently stop running those files while the suite still reported green.

This came out of the network-controller migration, where tests/ holds 18463 lines across three files, roughly 70 percent of that package's suite. It needed a per package include override to keep running them. Rather than have every such package rediscover that, the shared config now includes tests/**/*.test.ts as well.

Verified both directions. The eight packages already on Vitest are unaffected, since none has a tests/ directory containing test files, and all eight report the same counts as before. And a file placed in tests/ is genuinely picked up: base-controller goes from 1 file and 74 tests to 2 files and 75 tests with a probe in place.

Two packages will still need their own handling when their turn comes, and neither is made worse by this change. wallet-cli keeps its end to end suite in tests/ and its unit config ignores that directory on purpose, so it will need to exclude it. wallet-framework-docs keeps a test under content/ rather than tests/.

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-runner configuration only; no runtime or API behavior changes.

Overview
Expands the shared package Vitest include glob so suites match Jest-style layouts: tests under src/ still run, and tests/**/*.test.ts is 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 outside src/. Packages already on Vitest with only src/ tests are unchanged; packages that intentionally ignore tests/ (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.

This branch was successfully deployed

1 active deployment
default-branch — 27994237 Deployed Oct 17, 2026 by cryptodev-2s via Determine whether this PR is a release PR #5621
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