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.

Coverage breaks sourcemaps

See original GitHub issue

Issue :

If user enables test coverage with Jest then the sourcemaps are not correct.

Expected behavior :

Lines should be shown correctly, even if developer enables coverage report with Jest.

Minimal repo :

Github project: https://github.com/maxpolski/ts-react-jest/ Please kindly note that this is NOT my repository Run jest with coverage option. You will notice that the sourcemaps are not working correctly. To make sure, you can add console.log() in any React component and compare the line where console.log occured with the one displayed in the jest output. Interestingly, sourcemaps work absolutely fine in test files, but not in source files.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:28
  • Comments:11

github_iconTop GitHub Comments

9reactions
antonovichacommented, Aug 29, 2019

Was fixed in 23.1.2, see . But reproducible in: jest 24.9.0 + ts-jest 24.0.2 jest 23.6.0 + ts-jest 23.10.5 (latest 23.* versions as of today)

Workaround for debugging:

  • remove collectCoverage from config
  • add --coverage to jest cli in test script of package.json:
"test": "jest --config ./jestConfig.json --coverage"
8reactions
dgreene1commented, Dec 20, 2018

I confirmed that this was the cause of my inability to debug tests via vscode-jest. Turning off code coverage allowed the sourcemaps to be built properly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma Webpack sourcemaps not working - Stack Overflow
One solution is to configure karma and webpack to skip code coverage instrumentation when running tests in watch mode.
Read more >
source-map-loader - webpack
The source-map-loader extracts existing source maps from all JavaScript entries. This includes both inline source maps as well as those linked via URL....
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >
source-map | Yarn - Package Manager
Generates and consumes source maps ... Build Status. Coverage Status. NPM. This is a library to generate and consume the source map format...
Read more >
JavaScript Debugging with Sourcemaps - TrackJS
A sourcemap is a mapping between the generated/transpiled/minified JavaScript file and one or more original source files. The main purpose of sourcemaps is...
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