codelegant codelegant - 3 months ago 27
React JSX Question

jest --coverage show the wrong path

enter image description here

Like the pic above, I move the dir

__tests__
and file
LinkButton.js
from
demo
to
jest
, then run
npm test -- --coverage
in Terminal.

The test is passed, but the path in coverage is wrong. It seems the jest had cache the old path.

What's wrong with the jest? Waiting online, thanks very much.

GitHub: https://github.com/codelegant/react-action/tree/master/public/src

Answer

I checked your project and I think you're right. Look at execution times, it's only ~0,5s for one test. Try

npm test -- --coverage --no-cache 

to run your test without cache. Now test execution should take ~23s and path should be updated.