-
-
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
Error Cannot read property converageData of null #7758
Comments
It happens to me when I have Looking at the changelog, this seems to be related to this change: #7388 |
@alcferreira could you put together a reproduction? I'm unable to reproduce this |
Hi @SimenB, yesterday I managed to workaround this by ignoring the desired file on // jest.config.js
module.exports = {
collectCoverageFrom: [
'src/**/*.js',
'!src/**/*.(story|fixtur(e|es)).js',
'!src/fileToIgnore.js'
]
} I was trying to reproduce it again today but it worked fine after reinstalling dependencies. So it's all good here, thanks! |
So can we close it? |
I encountered this error today and was intent on reproducing it. But instead, I found the cause and fixed it for myself. In short, I am using TLDR; upgrading both |
It should be valid to use |
Here's a repo, with the repro: https://github.com/jylertones/jest-coveragedata-null |
@mengdage looks like |
Same issue for me, started to happen on Jest 24, with Jest 23.6.0 worked gine. I've both Jest@24 and babel-jest@24. |
Here is a minimal repro which doesn't use babel at all: https://github.com/bschlenk/jest-coveragedata-null Happens when a file has Ignoring the file with a negated pattern in |
@bschlenk I just came across this exact scenario and was about to wade in and report it. Literally And yes, @jeysal -- |
Just curious, is this something that would have been caught by typescript's strict null checking? I love that you guys have already completed your migration to typescript! |
In theory yes, but the types aren't accurate enough. See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b8ad888a0c38884420262330c49be3357516bc66/types/istanbul-lib-instrument/index.d.ts#L61 - it can also return |
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
When I attempt to run jest --coverage. I get the error above for paths to all my js files. For example as shown below. Having said that when I don't use the coverage flag and just run jest my test does run successfully. I took the react template from visual studio (it uses create-react-app v1) and upgraded jest to version 24.0.0 from 20.0.4. I suspect this has something to do with it.
To Reproduce
As indicated above
Expected behavior
Expecting a coverage of my code but got the errors indicated and this
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 14.29 | 0 | 0 | 14.29 | |
index.js | 14.29 | 0 | 0 | 14.29 |... 25,26,27,29,35 |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 15.854s
Ran all test suites.
Link to repl or repo (highly encouraged)
This would not be possible as it is company code.
Run
npx envinfo --preset jest
npx: installed 1 in 10.561s
Path must be a string. Received undefined
npx: installed 1 in 3.611s
C:\Users\dchoi1\AppData\Roaming\npm-cache_npx\8628\node_modules\envinfo\dist\cli.js
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Binaries:
Node: 8.11.3 - C:\Program Files\nodejs\node.EXE
npm: 6.2.0 - C:\Program Files\nodejs\npm.CMD
The text was updated successfully, but these errors were encountered: