vscode: Vitest extension doesn't rerun tests when test files change

Describe the bug

When test files change, Vitests extension doesn’t rerun them. The only way to rerun tests files and get new data is to click “Refresh tests” and then “Run tests” on every change inside test files. In terminal tests are rerunning normally on files save. I uploaded a short video

https://github.com/user-attachments/assets/17589783-8a98-4094-bc0a-a95d6b5a078e

Reproduction

Write any type of tests and run them

Output

.

Version

1.2.12 published 2024-09-30

Validations

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 13
  • Comments: 31 (10 by maintainers)

Most upvoted comments

This is my output

Your output just confirms that your tests are reruning

Yes but I never observed the test run. No test results were shown and the test icon never changed to this yellow icon one normally gets when rerunning tests. I always have to wait around 4~ seconds after changing the file to trigger a test rerun.

We’ve had issues like this for ages. But I don’t want to report it because there’s no way I can make a repro, and so it’ll just be closed.

Our developers have to reload VS Code like 10 times a day.

We are in the process of trying to switch to another test extension, but others are unstable too. We hope switching to Deno 2.0 will help, or perhaps even Bun when they finish their extension.

I hope someone finds a root cause. I wonder how many are secretly having this issue.

Having the same problem here, too. Despite enabling Continuous Run, updating tests does not trigger a rerun. I’m on macOS.

Expected: test to re run when file changed, and reflect with pass or fail icons in the editor. What actually happened: No passing icons showed, or changed, not matter fixing the test or making it fail.

minimal repo: https://github.com/fazulk/vitest-watch-bug

    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 271.44 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.local/state/fnm_multishells/26611_1744910863682/bin/node
    Yarn: 1.22.22 - ~/.local/state/fnm_multishells/26611_1744910863682/bin/yarn
    npm: 10.9.2 - ~/.local/state/fnm_multishells/26611_1744910863682/bin/npm
    pnpm: 10.6.3 - /opt/homebrew/bin/pnpm
    bun: 1.1.4 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 135.0.7049.85
    Edge: 133.0.3065.92
    Safari: 18.3

vitest output:

[INFO 10:42:39 AM] [Worker] Collecting tests due to file changes: src/dummy.test.ts
[10:42:39 AM] Not starting the runner because tests are being collected for src/dummy.test.ts
[10:42:39 AM] There is no test run for "dummy.test.ts"
[10:42:39 AM] There is no test run for "dummy.test.ts"
[10:42:39 AM] No test run to finish for src/dummy.test.ts
[10:42:39 AM] [VSCODE] Ignoring file: node_modules/.vite/results.json

Image

Image

@sheremet-va

Not having the same problem here!

Provide more info:

  • logs
  • what you expect to happen
  • what you actually did
  • reproduction steps
  • what Node you are using
  • a screen recording
  • screenshots
  • do you have continues run enabled
  • reproduction repos

Percieved bug might be a different bug. Just adding “+1” does not help fix the issue. It is insane that people expect this issue to be fixed without providing any help.

I am unsubscribing from this thread and coming back in several weeks. No help = no fix, I am not a magician. If someone else wants to step in, be my guest.