-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rerun on save not covering other test files #4997
Comments
Same goes for checking types using |
I don't understand you issue. Vitest reruns only affected tests on file change, not every test. |
Vitest shows that there's only 1 test file on a rerun, which isn't true. If I want to test just that file, I'll specify it when running the command. |
From what I can see in the reproduction, this issue is not about running affected tests, but running affected tests and tests that failed before. If I remember correctly, Vitest was running all failing tests plus affected tests before at some point, so this looks like a regression. What Vitest will not do is run all tests when one test is changed because it doesn't make any sense - the status of all your other tests will not change because test files are isolated. |
Yes, thanks, this is kinda what I was trying to convey. Was there a purpose to rerunning non-affected failed tests?
Makes sense — the results of the other tests can be reused regardless of their outcome. |
Maybe related to this PR? It looks like this PR is introducing "file change -> rerun file change and failed ones" |
Is there a flag or is vitest supposed to to always rerun all tests when any test file changes? That's what I've been searching for... |
@waynebloss Vitest is not supposed to do this as explained in #4997 (comment) This is expected to provide a better experience for most of the users, but if this behavior is not preferable for some reason, then it would help if you can share more details about your use case. As an exception, for example config files change, Vitest should re-run everything and we have |
@hi-ogawa Thank you. I am a new user giving Mainly, I just want to see all the nice check marks (and totals) all of the time. So I am having to use nodemon to work around this currently. The problem IMO is that the default console output is not stable after a rerun, so you have to scroll back up to history to see results from previous runs. It's also not stable depending on if there is more than one test file or not. (With a single test file, you get sub-check marks for each test in that file but with multiple test files you get no sub-check marks.) I know this is not the place for this issue and I haven't completely explored all the reporting options yet so perhaps I'll look at those and also give the UI a try. |
So, I solved my own related stability issue by just using |
@hi-ogawa Here is my final report in response to your query:
So I think a simple flag to allow always rerunning would be useful. |
@waynebloss Thanks for providing the details. It looks like you're feeling some UI/UX issues of builtin reporters, so if you want to expand on that, please feel free to open new issue or use new discussion if it's just a quick question https://github.com/vitest-dev/vitest/discussions As for In your case, probably https://stackblitz.com/edit/vitest-dev-vitest-xysf8w?file=vitest.config.ts |
@hi-ogawa That works very well, thanks again! I was also able to avoid creating a separate However, I can get rid of nodemon now and we'll see how that goes. Thank you very much for your help. |
As a team, we decided that it would be nice to show previously failed test files in the terminal, but we won't show the errors in those files to not clutter the output. The tests themselves will not be running, unless the change will affect the file. |
Describe the bug
In case of 2 or more test files, vitest in watch mode (command:
vitest
) doesn't rerun for all test files, only for the one file which was saved. Because of this, I can't see if any other tests are failing or not.Reproduction
Minimal repo: https://github.com/murolem/vitest-issue-not-rerunning-for-all-files
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: