fix(coverage): avoid matching sibling project roots by innoprej · Pull Request #10311 · vitest-dev/vitest (original) (raw)
Summary
Fixes coverage root filtering so a project root only matches files inside that exact root, not sibling directories that merely share the same string prefix.
Previously a root such as /workspace/packages/test could also allow /workspace/packages/test-a/... because the external-file check used a raw startsWith(root) comparison. This changes the check to require either an exact root match or a path-separator boundary.
Fixes #10289
Validation
pnpm -C test/coverage-test exec vitest run test/root-prefix.unit.test.ts --project unitpnpm -C test/coverage-test exec vitest run test/workspace.project-filter.test.ts --project istanbul --project v8