-
-
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
Feature request: Make "--changed" respect coverage or use static code analysis #6735
Comments
Sorry, but there is no |
Ah yes, brain fart from my side. I did mean changing the existing flag's behavior. |
Will you accept PRs for this? |
All suggested solutions seem like overkill to me. The second one seems impossible because Vitest doesn't have an in-memory coverage as far as I know (I might be wrong). To analyse AST, we need to process files with Vite into JavaScript first, which is not a problem and might be the easiest solution out of all of them, to be honest. (Btw, how do you parse dynamic test names?) To even work with coverage, you need to generate it, which means you need to store it just for This seems like a huge project, and I don't think anyone on the team wants to maintain it (We usually say no to features we can't maintain because Vitest is already pretty big). This will also require a big refactoring of the internals to have a map of tests to files ahead of time. Maybe others on the team have a different opinion? @hi-ogawa @AriPerkkio @antfu |
As said before, in order to use coverage for this we would first need to run all tests so that we have coverage results. That kind of breaks the intention of Are there any existing Javascript tools that have implemented this? What kind of logic would the static analysis part have? Implementing static analyses for dynamic cases is simply not possible. We need to evaluate the code for many cases. Tests are often very dynamic.
I'm quite curious how you would even start implementing this. 😄 |
Clear and concise description of the problem
What if Vitest kept track of which lines each test runs through. That way, the "--changed" flag would be truly only "changed", and could save a huge amount of test execution time.
In our test suite, we have a lot of end-to-end tests, as well as a lot of integration tests. So here, we don't care about Vitest's performance, because that's typically not the limiting factor. IO such as database operations and API calls is limiting instead.
So for that, to really cut off some test execution time, we need to be able to better restrict what tests are run.
--affected
does a great job already by looking at the import tree, but it could become even better. If this was implemented, it would be equal to how it works in IntelliJ based IDEs like WebStorm, IntelliJ and Rider, and it could be one of the only test libraries for node that would support this. So there's a lot of opportunity here.Suggested solution
The way I see it, it could be achieved in three ways.
Alternative
No response
Additional context
This was sparked here: #6734
Validations
The text was updated successfully, but these errors were encountered: