Describe the bug
When running vitest in watch mode, I typically supply a file pattern so that only one test file is re-run. But whenever I save a file, that pattern is dropped and vitest re-runs all tests instead of only the ones that match the supplied pattern.
Reproduction
- Create a
foo.ts file with export const foo = 2 as content
- Create two test files
foo.test.ts and fail.test.ts that both import foo.ts
- Start
vitest in watch mode and use foo as the file pattern
- Edit
foo.ts and hit save -> Both foo.test.ts and fail.test.ts are run, despite the foo file pattern filter
Stackblitz reproduction: https://stackblitz.com/edit/vitest-dev-vitest-fnc5cv?file=foo.ts,test%2Ffail.test.ts&initialPath=__vitest__
System Info
System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1
Memory: 81.88 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
Browsers:
Chrome: 109.0.5414.87
Firefox: 109.0
Safari: 16.2
Used Package Manager
npm
Validations
Describe the bug
When running
vitestin watch mode, I typically supply a file pattern so that only one test file is re-run. But whenever I save a file, that pattern is dropped andvitestre-runs all tests instead of only the ones that match the supplied pattern.Reproduction
foo.tsfile withexport const foo = 2as contentfoo.test.tsandfail.test.tsthat both importfoo.tsvitestin watch mode and usefooas the file patternfoo.tsand hit save -> Bothfoo.test.tsandfail.test.tsare run, despite thefoofile pattern filterStackblitz reproduction: https://stackblitz.com/edit/vitest-dev-vitest-fnc5cv?file=foo.ts,test%2Ffail.test.ts&initialPath=__vitest__
System Info
System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 81.88 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm Browsers: Chrome: 109.0.5414.87 Firefox: 109.0 Safari: 16.2Used Package Manager
npm
Validations