-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
In our project setup, we have a pre-processing step, so the test run against a lib folder instead of src. This causes differences in behavior between istanbul and v8 coverage providers.
When running tests with istanbul it follows the source maps and the resolves the file to the original index.ts source:
% Coverage report from istanbul
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
But it does not happen with v8, the report shows transpiled index.js
% Coverage report from v8
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
index.js | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
This becomes an issue when uploading reports to tools like Codecov, because they cannot match up the coverage report against the source
Reproduction
Minimal repro can be found here: https://github.com/just-boris/vitest-coverage-issue-5341
System Info
System:
OS: macOS 13.6.4
CPU: (10) arm64 Apple M1 Pro
Memory: 594.05 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - ~/n/bin/node
npm: 10.2.3 - ~/n/bin/npm
Browsers:
Chrome: 122.0.6261.94
Edge: 122.0.2365.63
Safari: 17.3.1
npmPackages:
@vitest/coverage-istanbul: ^1.3.1 => 1.3.1
@vitest/coverage-v8: ^1.3.1 => 1.3.1
vitest: ^1.3.1 => 1.3.1Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)