TypeScript and Jest - debugger stops only on breakpoints in tests, never in source files


I am using TypeScript and Jest.

I have no issue to get debugger stop on proper line in the test file, but I cannot get it stopped in the source files.


This is my `jest.config.json`:


module.exports = {
collectCoverage: true,
collectCoverageFrom: ['src/**/*.ts'],
globals: {
'ts-jest': {
tsConfig: {
sourceMap: true,
inlineSourceMap: true
preset: 'ts-jest',
testEnvironment: 'node',


Any help?


Try changing collectCoverage to false - does it help?

"collectCoverage": false,

If the source file is instrumented for coverage, the generated code can't be mapped to source; it's a well known limitation


Elena Pogorelova God bless you for this. I'd been struggling to get this work for days. Thanks.


If you want to keep that option in your config file, you can turn that off in the run configuration for Jest as well by adding the Jest option `--coverage=false`, ideally in the run configuration template.


I'm also trying to debug a Jest test in a complex monorepo. I've disabled coverage collection in both ways explained above, but I still can't get the debugger to stop on any line. Instead, WebStorm opens index.js (instead of staying in index.ts), and the debugged goes into a limbo state, when nothing seems to be going on.

This problem only occurred in one file. Another Jest TS from another project would debug fine.

I managed to get the debugger working on the problematic file as well, by deleting workspace.xml.

WebStorm 2019.3.3
Build #WS-193.6494.34, built on February 11, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-28-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 935M
Cores: 8
Non-Bundled Plugins: com.intellij.lang.jsgraphql


Please share a sample project the issue can be reproduced with


If only it were that easy :( I'm working on a complex project with proprietary code and the issue happens with only one very large file. It happened again after I added a few lines of TypeScript (a type definition) near the top of the file. WebStorm keeps opening the .js file every minute or so, even though I closed the file switched to a different task (but the debugger was still apparently "running" - I hadn't clicked the square button to stop it).

Invalidating caches and restarting didn't help, but removing the XDebuggerManager tag in workspace.xml worked.


make sure to set the following in your tsconfig.json:

"sourceMap": true,
"inlineSourceMap": true.


Also seeing a similar problem - 
Debugging a Jest test in IntelliJ - 
- Debugger stops at many places before arriving to actual Break Points.
- Mostly stops at places that are not really code (comments, empty lines)
- Arriving to the actual breakpoint, sometimes after 5-9 stops.
- Tried the above suggested solutions - ie.
Adding to Jest config file -

"collectCoverage": false,

Running with


Also tried - 

removing the XDebuggerManager tag in workspace.xml

And setting in tsconfig.json:

"sourceMap": true,
"inlineSourceMap": true.


This happens to many others in my company.


Lior Chervinsky do you use esbuild-jest as a transformer? If yes, you can try the workaround from https://youtrack.jetbrains.com/issue/WEB-56757/Debug-doesnt-work-with-typescript-jest-and-jest-esbuild#focus=Comments-27-6728620.0-0

If your configuration is different, please share a sample project the issue can be reproduced with


Note: tsconfig.json - error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.


Please sign in to leave a comment.