ts-jest: Partial code coverage or incorrect mapping
- Issue
Hi and thanks for all the job done for this library ๐
I have probably the same issue as https://github.com/kulshekhar/ts-jest/issues/339 but with a single repo. The solution pointed in the issue is not suitable in my case.
I either have an incorrect code mapping on coverage without "mapCoverage": true or missing files when this option is removed + an almost correct mapping.
Incorrect mapping + all files covered
------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
------------------------------|----------|----------|----------|----------|----------------|
All files | 83.33 | 100 | 66.67 | 75 | |
rnTsWithJest | 100 | 100 | 100 | 100 | |
App.tsx | 100 | 100 | 100 | 100 | |
Home.tsx | 100 | 100 | 100 | 100 | |
rnTsWithJest/core/locales | 0 | 100 | 0 | 0 | |
index.ts | 0 | 100 | 0 | 0 | 4 |
rnTsWithJest/core/locales/en | 100 | 100 | 100 | 100 | |
common.ts | 100 | 100 | 100 | 100 | |
index.ts | 100 | 100 | 100 | 100 | |
rnTsWithJest/core/locales/fr | 100 | 100 | 100 | 100 | |
common.ts | 100 | 100 | 100 | 100 | |
index.ts | 100 | 100 | 100 | 100 | |
------------------------------|----------|----------|----------|----------|----------------|
(Almost) Correct mapping + missing covered files
---------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---------------------------|----------|----------|----------|----------|----------------|
All files | 83.33 | 100 | 66.67 | 83.33 | |
rnTsWithJest | 100 | 100 | 100 | 100 | |
App.tsx | 100 | 100 | 100 | 100 | |
Home.tsx | 100 | 100 | 100 | 100 | |
rnTsWithJest/core/locales | 0 | 100 | 0 | 0 | |
index.ts | 0 | 100 | 0 | 0 | 5 |
---------------------------|----------|----------|----------|----------|----------------|
- Expected behavior
Having correct code mapping on coverage report without missing covered files.
Any help would be greatly appreciated.
- Minipal repo
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 7
- Comments: 36 (10 by maintainers)
Looks that after I upgrade to Jest 23.4.2 and ts-jest 23.1.3 the coverage is mapped correctly. Thank you guys!
@kulshekhar thanks for your fast reply ๐
I just shaved a lot of noise to make your work easier. Screenshots and reports have been updated too. Let me know if you need anything else to solve my issue.
I can confirm the coverage report is now correct with
23.1.2andskipBabel: false. Thank you for the great work ๐@jscinoz you should test with latest ts-jest
23.1.2. If there is still a problem, please create a new issue with a minimal repo.I am closing this right now (see https://github.com/kulshekhar/ts-jest/issues/371#issuecomment-408749694)
for me the not executed files during tests are still showing weird coverage mappings.
Tried with jest 22.4.2 and ts-jest 22.4.0
Iโd probably start by checking the babel step, which is in the postprocess file. Reproduce the bug in a repo, and perhaps try comparing it to output manually generated by tsc. To see whether we mess up before sending it to babel somehow or the babel step isnโt configured properly. Itโs not much of a lead to go on, but itโs my best guess.
@jscinoz Iโve also changed this in jest config (but that doesnโt affect anything anyway):
Iโm now getting the following error:
Would it be possible for you to get the linked repo to a state where it shows just the wrong coverage without other errors?