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.

Source maps are mis-aligned

See original GitHub issue

🐛 Bug Report

Jest errors that show line numbers and code snippets aren’t showing the right thing.

This seems to happen by merely including another package that already loads source-map-support module prior, for example pino-caller. You can see the code for pino-caller is very simple, and in fact no code paths get triggered, other than just the loading of the module itself.

When I comment out the require line in pino-caller, the source maps align fine.

I’ve looked at other source maps issues here, and none of them seem to be relevant to this.

To Reproduce

require('pino-caller')

describe('Name of the group', () => {
  it('should work', () => {
    // comment

    throw new Error('foo')
  })
})

Results in:


      4 |   it('should work', () => {
      5 |     // comment
    > 6 |
        | ^
      7 |     throw new Error('foo')
      8 |   })
      9 | })

      at Object.<anonymous> (test/foo.test.ts:6:15)

Expected behavior

To point to the right line of code.

Link to repo (highly encouraged)

Can create, if necessary.

envinfo

System:
    OS: macOS

Npm packages:
    jest: 26.1.0
    ts-jest: 26.1.3
    typescript: 3.8.3
    babel(optional): N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ahnpnlcommented, Jul 24, 2020

Oh actually I was asking whether or not that source-map-support is needed for your code 😃 It seems like not needed.

Will need to check whether it is jest bug or ts-jest, will keep you update

0reactions
moltarcommented, Jul 27, 2020

Ok, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source maps are mis-aligned · Issue #10330 · facebook/jest
This seems to happen by merely including another package that already loads source-map-support module prior, for example pino-caller .
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 >
Angular 2 RC5 webpack source maps misaligned for debugging
I'd love ideas on the source of this problem and how to fix it. Chrome Debugger. Chrome 52. webpack 1.13.1 with config.devtool =...
Read more >
[Solved]-Angular 2 RC5 webpack source maps misaligned for ...
Coding example for the question Angular 2 RC5 webpack source maps misaligned for debugging-angular.js.
Read more >
ArcGIS Server features are not aligning with maps in Google ...
Right-click on the layer and click Properties. In the Layer Properties dialog box, select the Source tab. The information should be listed in...
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