question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
SimenBcommented, Mar 29, 2020

Yup, 25.2.4 has a fix for this

1reaction
ahnpnlcommented, Mar 29, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am I getting 0 coverage from Jest when running it from ...
The problem was that jest assumes the configPath to be the root directory and thus doesn't find any files to check the coverage...
Read more >
ts-jest | Yarn - Package Manager
A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. NPM version NPM downloads Known...
Read more >
Configuring Jest
If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file...
Read more >
jest-coverage-guard - npm
Locally the script will check coverage on all files that you have changed and committed implementing current feature and all files that you...
Read more >
Measuring Typescript Code Coverage with Jest and GitHub ...
Running Typescript Tests and Coverage Locally with Jest. Let's get ... Be sure to add the following two lines to the jest.config.js file:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found