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:
- Created 3 years ago
- Comments:5
Top 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 >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
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 updateOk, thanks!