Watch mode "f" command does not rerun failed tests #3687
Open
Description
Describe the bug
When in watch mode and pressing "f" to rerun failed tests, "rerun failed" is printed and failed tests are reran but the watcher does not remember that I pressed f on file changes. I would expect a file change to rerun only the failed tests as long as I have selected the "f" command like in Jest.
Reproduction
- wait for the tests to run
- in watch console press "f"
- notice "rerun failed" is printed and the whole suite containing the failed test reruns
- trigger a file change in basic.test.js
- notice that only basic.test.js was reran, disregarding that I was in failure only mode.
I expected the watcher to stay in "rerun failed" mode, rerun suite.test.js, and behave in that way until I exit "rerun failed" mode by pressing "a" or "r".
System Info
The stackblitz env is this
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.3 - /usr/local/bin/pnpm
npmPackages:
@vitest/ui: latest => 0.32.2
vite: latest => 4.3.9
vitest: latest => 0.32.2
But I have the same problem locally on
System:
OS: macOS 13.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 3.76 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
npm: 8.18.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
Browsers:
Brave Browser: 113.1.51.110
Chrome: 109.0.5414.87
Edge: 114.0.1823.51
Firefox: 112.0.1
Safari: 16.4
npmPackages:
@vitejs/plugin-basic-ssl: ^1.0.1 => 1.0.1
@vitejs/plugin-react: ^3.1.0 => 3.1.0
@vitest/coverage-c8: ^0.32.2 => 0.32.2
@vitest/ui: ^0.32.2 => 0.32.2
vite: ^4.1.1 => 4.1.1
vitest: ^0.32.2 => 0.32.2
### Used Package Manager
npm
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.