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.

Sourcemaps break error reporting in Jest

See original GitHub issue

Sourcemaps seem to break error reporting in Jest. Every time TypeORM throw an error while running tests with Jest I get something like this:

ENOENT: no such file or directory, open '/Users/timon/Projects/typeorm-jest-bug/src/metadata-builder/EntityMetadataValidator.ts'

Removing the sourcemap for EntityMetadataValidator.ts seems to fix the problem. It also only happens in Jest, when I run the code in Node it works perfectly fine.

I made a repository as to easily reproduce the bug: https://github.com/TimonVS/typeorm-jest-bug

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hmilcommented, Dec 22, 2017

I’m no Jest expert but your test repo gets fixed by downgrading jest and ts-jest to versions 21.x.x

--- a/package.json
+++ b/package.json
@@ -5,8 +5,8 @@
   "devDependencies": {
     "@types/jest": "^21.1.8",
     "@types/node": "^8.0.29",
-    "jest": "^22.0.3",
-    "ts-jest": "^22.0.0",
+    "jest": "^21.0.0",
+    "ts-jest": "^21.0.0",
     "ts-node": "3.3.0",
     "typescript": "2.5.2"
   },

Try to isolate whether it’s due to ts-jest or jest and file an issue over there.

0reactions
canhnhtcommented, Jan 19, 2018

Thank you @hmil !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coverage breaks sourcemaps #917 - kulshekhar/ts-jest - GitHub
Issue : If user enables test coverage with Jest then the sourcemaps are not correct. Expected behavior : Lines should be shown correctly, ......
Read more >
TypeScript debugging with Visual Studio Code
TypeScript debugging supports JavaScript source maps. To generate source maps for your TypeScript files, compile with the --sourcemap option or set the ...
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 >
Jest + Babel: Debugger stops on a wrong line : WEB-27680
Whenever I debug a Jest unit test with transpiled es6 with sourcemaps using babel, there are substantial problems setting breakpoints that actually work...
Read more >
Why does the stack trace for my jest tests point to the wrong ...
It has to do with source maps. If those are not correctly generated or processed, the debugger will show the wrong line. I...
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