-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest coverage reporting #3753
Comments
i think you should never try to collect coverage from anything inside I looked into the issue though. There are two places that prevent files from being instrumented:
|
actually i think the first one is not a jest bug, there's a hidden check for so i think the only place that forces |
Hello @DmitriiAbramov , Thanks for looking into this issue report. My intention is to remove the default value from Regarding 2, it can be related with the way the flag
Still even if I have placed the file on a different folder let's say /src/Yeah_module (which does not require changes to the Thanks, |
Hey @joaocfernandes, Regarding 2 I think you were affected by a bug that got fixed in this PR: #4432 Can you test if this resolves the rename problem you are experiencing? |
Hi @stipsan, No duplicates occur now. Still the path to the file is incorrect. |
Thanks @joaocfernandes. Since the problem happens when you add |
2 seems fixed, 1 and 3 are still broken with the current version of Jest. |
Try P.S. 2nd or 3rd confusing issue with jest TS cache :(. |
Just made a small check again.
|
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
What is the current behavior?
From what I understood currently by default jest does not perform src coverage extraction for any code that is contained within a /node_modules/. That behavior is determined through the coveragePathIgnorePatterns array of regexp. I have changed it to other value, still coverage extraction is not performed or is erroneous. Please apologize if this was an error on my side.
I have created a sample repository where I try to reproduce some of the sample issues I have came into.
Please refer to the https://github.com/joaocfernandes/jestcov for the following samples.
1. Coverage is not performed, refer to Branch Master
The coverage target file is contained within a src/node_modules/sum.js. The coveragePathIgnorePatterns has an "abcd" regexp. No coverage is extracted. The coverage folder is created at the default location /coverage/.
2. (SOLVED) Coverage is performed but is incorrect, refer to Branch WorkExample
The folder name was renamed from src/node_modules to src/Yeah_modules.
If we run the jest normally the coverage presented reference two different sum.js source files, where which of one does not exists. Global coverage value is incorrect for statements, functions and lines.
3. Coverage is performed but is correct, but file path is incorrect refer to Branch WorkExample
If jest is run ignoring cache the coverage is correctly listed but the src file path is incorrect. It should be listed under src/Yeah_modules/
What is the expected behavior?
Jest should extract coverage taking into account the coveragePathIgnorePatterns , report correct coverage and correct source files path.
WIndows 10
Node v7.8.0
npm 4.2.0
Jest 20.0.4
The text was updated successfully, but these errors were encountered: