@vitest/coverage-c8
includes generated __vite_ssr_exports__
helper in coverage
#3237
Closed
6 tasks done
Labels
feat: coverage
Issues and PRs related to the coverage feature
Describe the bug
When a source file declares named export that is transformed into
__vite_ssr_exports__
by Vite, the@vitest/coverage-c8
coverage reports increase function count by 1 and consider theObject.defineProperty(__vite_ssr_exports__, ...
as part of source code. This is due toObject.defineProperty(__vite_ssr_exports__, ...
being included in the source maps.Reproduction
This can be reproduced in Vitest repository's
test/coverage-test
whenc8
is used. All files have function counts that do not match. (#3226 (comment))This is also seen when adding an unused
export
. The line that is marked as uncovered contains theObject.defineProperty(__vite_ssr_exports__, ...
whereget()
is not executed since no one imports that file. Thisget() {}
also increases function count by one.System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: