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

Steps to reproduce the behavior:

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 repl or repo (highly encouraged)

envinfo

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
  Binaries:
    Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.6 - ~/.nvm/versions/node/v12.18.2/bin/npm
  npmPackages:
    jest: 26.1.0 => 26.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:11

github_iconTop GitHub Comments

3reactions
dmaretskyicommented, Aug 14, 2020

Repo with minimal code to reproduce: https://github.com/Marik-D/jest-source-map-issue

require('source-map-support').install() //commenting out this line makes the issue dissapear






test('test', () => {
  expect(false).toEqual(true)
})

Looks like just using jest with source-map-support is enough to reproduce.

Also, console logs and nodeā€™s assert are unaffected by this issue.

0reactions
github-actions[bot]commented, May 10, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
Source Map Revision 3 Proposal
Add ā€œsourcesContentā€ line to support self contained source maps. ... to avoid becoming misaligned with the original due to platform specific line endings....
Read more >
Misaligned Tileset - Do I need to edit source image?
I'm having real issues trying to get my tiles aligned on my tileset :melting_face: Here's my tileset below I've tried adding a 1px...
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