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:
- Created 3 years ago
- Reactions:3
- Comments:11
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Repo with minimal code to reproduce: https://github.com/Marik-D/jest-source-map-issue
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.
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.