Skip to content

Error Cannot read property converageData of null #7758

@jsoneaday

Description

@jsoneaday

🐛 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.

Failed to collect coverage from C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\src\silos\administration\components\Portfolio\ShareClassFeeEditor.js
ERROR: Cannot read property 'coverageData' of null
STACK: TypeError: Cannot read property 'coverageData' of null
    at _default (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest\node_modules\jest-cli\build\generateEmptyCoverage.js:72:44)
    at Object.worker (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest\node_modules\jest-cli\build\reporters\coverage_worker.js:51:45)
    at execFunction (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest-worker\build\workers\processChild.js:165:17)
    at execHelper (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest-worker\build\workers\processChild.js:149:5)
    at execMethod (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest-worker\build\workers\processChild.js:153:5)
    at process.on.request (C:\Source\ReportingSolution\DEV\Web\Acre.Web.ReportQuery\ClientApp\node_modules\jest-worker\build\workers\processChild.js:72:7)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions