debugger not started and not attached for jest tests on WebStorm 2020.1 Ubuntu

I have default jest config. Which is working on MacOs - when I click debug button - debugger started and attached automatically. And Im able to debug my tests. But for my fresh ubuntu setup it look like not working. Test are runned normally - but in console - no debugger activity. Any ideas?

15 comments
Comment actions Permalink

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

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

2
Comment actions Permalink

Hello Elena,

 

Seems that if I make a new project, with create-react-app debugging works. In our project we use react native with typescript. Ill try making a project similar to ours.

 

Thanks, will keep updating this thread with what I find.

1
Comment actions Permalink

>I'm using node interpreter under WSL Ubuntu

That's the issue. Please follow https://youtrack.jetbrains.com/issue/WEB-48766 for updates

1
Comment actions Permalink

What Node.js version do you use? Could you check if debugging Node.js apps work for you?

0
Comment actions Permalink

Node.js v13.13.0. Direct debugging is ok. The thing is that in WS jest test console there is no debug related commands appear for ubuntu. But when I run debug from WS on mac - there are: debugger started on ws socket and debugger attached.

0
Comment actions Permalink

can't reproduce the issue with your project + Node.js 13.13.0 - debugging works as expected...


Could you share a screenshot of the Debugger Console tab with the command line expanded? also, does disabling all custom plugins make things any better?

0
Comment actions Permalink

I get the same thing, only that it doesn't work anywhere, not even ubuntu, mac or windows. The console just before the test says it attached but I have no check-marks on the breakpoints and it just finishes the tests

 

Here's a youtube link showing the bug. The operating system here is Ubuntu 20.04.1 LTS, the same thing on mac book pro running catalina and windows 10. Also running with jest 26.4.2

PS: I did try to downgrade node version to 13.13.0, still happens.

0
Comment actions Permalink

Must be related to sourcemaps; please share a project the issue can be repeated with

0
Comment actions Permalink

Thank you, looking forward to your feedback!

0
Comment actions Permalink

Hi Elena Pogorelova

I'm facing a similar issue which seems to be all Webstorm related.

Debugging my jest testcases used to work just fine, but now when I start a test in debug mode, it s not showing "Debugger listening... Debugger attached" anymore right after jest --runInBand

I can manage to make it show "Debugger listening" by adding an --inspect node argument option to the run/debug configuration. It's like webstorm is not actually starting node/jest in debug mode.

I cannot be sure unless I downgrade Webstorm, but I believe the only change I made recently in my env was upgrading webstorm to 2020.3.1

I'm using:

  • typescript 4.1.3
  • ts-jest 26.4.4
  • jest 26.6.3

Could you please assist ?

Cheers

0
Comment actions Permalink

what Node.js interpreter do you use? Please share a screenshot of your run configuration

0
Comment actions Permalink

Here it is:

I'm using node interpreter under WSL Ubuntu

0
Comment actions Permalink

Thanks Elena Pogorelova ! Any idea about a workaround in the meantime ? This basically keeps us from debugging our code...

0
Comment actions Permalink

no workarounds, except for using a local node interpreter instead of the WSL one...

0
Comment actions Permalink

Enabling sourceMap & inlineSourceMap in tsconfig.json solves it for me - as suggested by Fabian Sellemond , Elena Pogorelova

I use a separate TS config for test, and pass that to jest.config.js , eg:

module.exports = {
preset: 'ts-jest',
globals: {
"ts-jest": {
tsconfig: 'tsconfig.test.json', // use test config to support debugging {inlineSourceMap:true, sourceMap:true}
}
},
...
}

 

0

Please sign in to leave a comment.