Skip to content

Run all tests, but report partial coverage, for CI purposes #8747

@kneczaj

Description

@kneczaj

Clear and concise description of the problem

This is quite common need at CI pipeline that these two objectives need to be fulfilled:

  1. run all tests
  2. 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:

  1. run all tests: vitest run
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: coverageIssues and PRs related to the coverage featurep2-nice-to-haveNot breaking anything but nice to have (priority)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions