Skip to content

Why does code coverage in a monorepo require a root vitest.config.ts? #454

Answered by sheremet-va
kieranm asked this question in Q&A
Discussion options

You must be logged in to vote

coverage field never worked with workspace project's configs:

Even with Vitest CLI, you will not get the coverage if you run it from the root. Of course, if you run tests from the project directory, Vitest will pick up its config and won't use workspaces at all - then it will print the coverage, but it will be scoped only to the project itself.

This limitation exists because coverage is reported for every workspace project - you can't reconfigure it midthrough. That's the whole point of the workspace.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kieranm
Comment options

@sheremet-va
Comment options

Answer selected by kieranm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants