-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Clear and concise description of the problem
This is quite common need at CI pipeline that these two objectives need to be fulfilled:
- run all tests
- compute coverage of a pull request
The problem is that the second command reruns the same tests. When we talk about CI pipeline which does these two jobs, this is a lot of wasted time.
Suggested solution
My request is to add functionality to limit only collecting the coverage to what --changed (or similar) flag says, and still run the full test set. This could be e.g. --changed-coverage param.
Alternative
First
Currently this can be achieved by two separate commands, but takes up to twice as much time depending on changes:
- run all tests:
vitest run - compute coverage of a pull request:
vitest run --coverage --changed=origin/main
Second
Compute coverage of all the project. Unfortunately this blurs the result as it includes a lot of files which are unrelated to pull request. This also is a problem at legacy projects which are in the process of increasing test coverage as unrelated files which may have no coverage are mixed with affected files with missing coverage.
Additional context
This is performance improvement for CI pipelines which use vitest
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.