Ts-jest: Get 0% coverage for JS files after jest v25.2.0

Created on 29 Mar 2020  路  6Comments  路  Source: kulshekhar/ts-jest

Issue :

Get 0% coverage for JS files after jest v25.2.0 ,
my Project:

<ROOT>
|__ jest.config.js
|__ tsconfig.json
|__ index.js
|__ index.d.ts
|__ tests
     |__index.test.ts

I just use a TS spec file to test a JS file with a .d.ts file. Every thing were good until I upgrade jest
up to v25.2.0

Tests were still ok and shown correct locations for any errors.
But it failed on coverage

It shown results like

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

Expected behavior :

Debug log:


log file content

# content of ts-jest.log :

Minimal repo :

My Project is clipy-mate-core
You can run npm run coverage before and after jest upgraded.

Question

Most helpful comment

Yup, 25.2.4 has a fix for this

All 6 comments

Are you able to reproduce with Babel-jest ? Did you also clear cache after upgrading jest ? Jest has v25.2.3 did you try it ?

Are you able to reproduce with Babel-jest ?

It is a node.js project so I didn鈥檛 use bable.

Did you also clear cache after upgrading jest ?

Yes I did.

Jest has v25.2.3 did you try it ?

Yes, I tried 25.2.0, 25.2.1 , 25.2.2 and 25.2.3
every version have the same problem until I downgraded it under 25.1.0

This can be an issue with jest 25.2 I鈥檓 not sure. If you can reproduce with Babel-jest, it will confirm that is jest regression issue.

To use Babel-jest very simple. You can follow this project https://github.com/ahnpnl/ts-jest-babel-example . Then in your jest config, define transform ts/tsx with babel-jest. Clean cache and retry to reproduce.

Would you please help us to check that ?

tag @SimenB I think this is jest regression, isn't it ? I saw 25.2.4 release seem to contain something related to this.

Yup, 25.2.4 has a fix for this

@ahnpnl @SimenB
It works in v25.2.4, Thank you very much

Was this page helpful?
0 / 5 - 0 ratings