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.

Jest source maps not working

See original GitHub issue

Hey there!

I’m pretty new to TypeScript/jest and I spent hours in figuring out why line numbering in failing tests are wrong so please bear with me.

I’m not sure if I missed something or it’s an actual bug and I couldn’t find anything close to my problem online. When running install(), line numbering breaks, when commenting it out, everything works fine (but of course stack traces don’t work any more). It doesn’t matter if install() is run in test code or in imported production code, test line numbering always breaks.

I have set up a demo repo over here.

Thanks for your help!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

1reaction
stavalficommented, Feb 5, 2021

as a workaround:

if (!process.env.TEST_MODE) {
  require('source-map-support').install()
}

until this issue is fixed.

also, https://github.com/evanw/esbuild has impact as well because of this issue. probably https://github.com/swc-project/swc also.

1reaction
schw4rzlichtcommented, May 25, 2020

I just tested 0.5.0 and 0.5.18 and they both have the same problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure source maps when using Jest within Visual ...
I have tried setting the sourceMaps prop to both true and inline and both did not work with current launch.json configuration. Here is...
Read more >
@jest/source-map | Yarn - Package Manager
Fixed change events to be emitted in jest-haste-map's watch mode. This fixes issues with Jest's new watch mode and react-native-packager. Fixed cli arguments...
Read more >
@jest/source-map - npm Package Health Analysis | Snyk
The npm package @jest/source-map was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
@jest/source-map - npm
Start using @jest/source-map in your project by running `npm i @jest/source-map`. ... This package does not have a README.
Read more >
Configuring Jest
The Jest philosophy is to work great by default, but sometimes you just need ... Node.js core modules, like fs , are not...
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