Vitest reruns tests on every change and doesn't show the results in the interface which pushes pressure on the CPU.
Vitest provides watchTests API that we need to call whenever we receive a TestRunRequest that supports continuous mode:
function runTests(tests, continuous?) {
if (continuous) {
vitest.watchTests(tests)
} else {
vitest.watchTests(['non-existing']) // so watcher never triggers a rerun for these files unless we run them manually
}
}
We need to collect tests when the file changes. The current implementation imports the file on every change to collect tests, but it doesn't run the tests themselves.
Describe the bug
Vitest reruns tests on every change and doesn't show the results in the interface which pushes pressure on the CPU.
Vitest provides
watchTests
API that we need to call whenever we receive a TestRunRequest that supports continuous mode:Reproduction
https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/
System Info
Used Package Manager
npm
Validations