Closed sinkcup closed 2 years ago
I have the same issue as well, I have
"jestrunner.jestCommand": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
in my settings.json, and it works for run, but is unused for debug
does this isue still persists with 0.4.48 ?
yes, 0.4.48 still has this bug. @firsttris
I would love to see this fixed as well as I can't debug in certain scenarios because I need to run a custom NPM script in order to have all the settings line up.
Any news about it?
this should already be possible:
see the code: https://github.com/firsttris/vscode-jest-runner/blob/master/src/jestRunner.ts#L143
you should be able to overwrite the complete debug config to your specific requirements:
example:
{
"jestrunner.debugOptions": {
"program": "pathToJestExecutable",
"env": {
"YOU_ENV_VARIABLE": "value"
}
}
}
Please report back if it works
maybe we should include into the readme.md
@firsttris it works!
"jestrunner.debugOptions": {
"program": "node_modules/jest/bin/jest.js",
"env": {
"NODE_OPTIONS": "--experimental-vm-modules"
}
},
"jestrunner.jestCommand": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
I'm using a monorepo with root-level dependencies. "Run" works and "Debug" doesn't. The following does NOT correct my problem:
"jestrunner.jestCommand": "npx jest",
"jestrunner.debugOptions": {
"program": "npx jest"
}
I get this error:
Error: Cannot find module '/Users/joe/repos/fieldzoo/utils/kysely-tables/node_modules/jest/bin/jest.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
at Module._load (node:internal/modules/cjs/loader:893:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
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"
},
config
Jest Command
or set ENV is useful forRun
, but not forDebug
.