Source map files disappear from coverage report
See original GitHub issueHi,
I’m getting coverage issues with Jest. When I set mapCoverage: true, some files disapear from the coverage report.
Example:
# mapCoverage:true
src/api | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
linkHeaderParser.js | 100 | 100 | 100 | 100 | |
repositories.js | 100 | 100 | 100 | 100 | |
src/components | 7.84 | 2.94 | 5.88 | 11.76 | |
FileExplorer.vue | 0 | 0 | 0 | 0 |... 51,52,53,54 |
MenuUserRepoList.vue | 0 | 0 | 0 | 0 |... 32,33,34,35 |
Profile.vue | 0 | 0 | 0 | 0 |... 57,58,59,60 |
Readme.vue | 80 | 50 | 50 | 80 | 23 |
# mapCoverage:false
src/api | 92.86 | 84.21 | 100 | 92.86 | |
index.js | 84.62 | 66.67 | 100 | 84.62 | 10,26 |
linkHeaderParser.js | 100 | 100 | 100 | 100 | |
repositories.js | 100 | 100 | 100 | 100 | |
users.js | 100 | 100 | 100 | 100 | |
src/components | 53.4 | 29.73 | 40.74 | 51.61 | |
FileExplorer.vue | 0 | 0 | 0 | 0 |... 51,52,53,54 |
FooterBar.vue | 92.86 | 50 | 100 | 100 | 4,5,6,7 |
MenuNavBar.vue | 100 | 50 | 100 | 100 | 20,21,22 |
MenuUserRepoList.vue | 0 | 0 | 0 | 0 |... 32,33,34,35 |
Profile.vue | 0 | 0 | 0 | 0 |... 57,58,59,60 |
Readme.vue | 94.74 | 57.14 | 80 | 92.86 | 25 |
RepoListItem.vue | 100 | 50 | 66.67 | 100 | 45,46,47 |
(I remove some file for a better readability. See full coverage report (link to travis build):
All sources files are available here: https://github.com/maxpou/gitvub and jest config here
Thank you
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:42 (5 by maintainers)
Top Results From Across the Web
Missing .vue file in coverage report - Stack Overflow
I use vue-cli 3.0 to create my project, and I use istanbul-instrumenter-loader to create my coverage, but I can't find vue file.
Read more >JavaScript source map upload - Bugsnag docs
Uploaded source maps can be viewed and deleted by going to Project Settings -> Source maps. Do the uploaded source maps get applied...
Read more >Debug Angular apps in production without revealing source ...
The source map contains a file property which points to the original file the source map belongs to. If we built our app...
Read more >ng test - Angular
Option Description Value Type Defau...
‑‑browsers Override which browsers tests are run against. string
‑‑code‑coverage Output a code coverage report. boolean false
‑‑code‑coverage‑exclude Globs to exclude...
Read more >Source map errors — Firefox Source Docs documentation
Source maps are JSON files providing a way to associate transformed sources, as seen by the ... The source map resource can be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Looks like the missing files lack the data property. If the component doesn’t have the data segment it is dropped from the coverage report. Adding an empty segment is enough to get it included.
I have been dealing with this issue setting up a new project. It can be reproduced using the latest vue-cli (3.0.5) and following the “Creating a Project” guide (https://cli.vuejs.org/guide/creating-a-project.html#vue-create).
Edit
jest.config.jsand add:Run
npm run test:unitNotice that
HelloWorld.vueis missing from the test report.Edit
components/HelloWorld.vueand add in an empty data segmentRun
npm run test:unitagainNotice that
HelloWorld.vuesuddenly appears with its test coverage.Thanks @nirkki for the workaround!! I have been parsing bug reports all evening with no luck as to what was causing this missing coverage.
The package.json that results from the vue-cli build:
It’s not a vue-cli issue, either, as I originally ran across the bug with a manual setup. In that scenario, the empty data segment also fixed the issue. That package json looks like: