firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
264 stars 124 forks source link

Setting "Jest Command" is ignored for Debug #284

Open westonNexben opened 1 year ago

westonNexben commented 1 year ago

The setting works for non-Debug.

"node_modules/jest/bin/jest.js" is always run instead when trying to Debug.

bigman73 commented 1 year ago

I have the same issue.

ysoussov commented 1 year ago

same issue here - any thoughts on how to fix this?

anasanzari commented 1 year ago

@westonNexben jest command is ignored because 'node' is used as executable: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-support-for-npm-and-other-tools

It is possible to override arguments by defining runtimeArgs and args inside debugOptions, for example:

"jestrunner.debugOptions": {
    "args": ["--no-cache"],
    "runtimeArgs": [
      "-r", "tsconfig-paths/register"
    ]
}
domsleee commented 11 months ago

Currently, jestrunner.jestCommand is not used in debug 👍

I think the closest equivalent is runtimeExecutable, which can be configured like this (see also CRA example in the readme):

"jestrunner.debugOptions": {
    "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
}

Does it solve the use cases if runtimeExecutable is set to the same value as jestrunner.jestCommand?

Also the debug button is a launch configuration, the options are documented here: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-attributes