Open bigman73 opened 1 year ago
According to this comment, "Debug" uses setting jestrunner.debugOptions
rather than jestrunner.jestCommand
, but I still can't get it to work in my monorepo with central dependencies. "Run" works just fine:
"jestrunner.jestCommand": "npx jest",
"jestrunner.debugOptions": {
"program": "npx jest"
},
Why doesn't "Debug" use jestrunner.jestCommand
? And why is it not using program
, instead reporting that it can't find a particular absolute path to jest.js
?
UPDATE: I have the following working for both "Run" and "Debug". It requires that all of my monorepo workspaces be at the same depth:
"jestrunner.jestCommand": "npx jest",
"jestrunner.debugOptions": {
"program": "../../node_modules/jest/bin/jest.js"
},
I'm building a Typescript (4.9.4) package with ESM (type: module), ES2022, and pnpm.
I managed to run jest from CLI by adding the NODE_OPTIONS:
jest runner got the same treatment and it runs from VS Code by changing the
jestrunner.jestCommand
setting to:When running a test from VS Code this way, it works fine, as expected.
Debugging is not working. The jestCommand is ignored in debug mode, as a result the NODE_OPTIONS are not applied. There's a related issue on this which got no response - https://github.com/firsttris/vscode-jest-runner/issues/284
Perhaps the correct solution is to add support for user defined NODE_OPTIONS, instead of requiring the user to change the entire command, and then jest runner can apply the NODE_OPTIONS in both run and debug modes, if the user specified it. Another option is to have two user defined commands - one for run and one for debug.
This is an example of a produced debug CLI command when running from VS Code even with the jestCommand setting modified:
Which results in a failure since ESM experimental feature is not applied to Node: