-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breakpoints not working for ECMAScript module package with default debug config #912
Comments
@rickstaa you are right that the debugger doesn't use Looks like you have already figured out a working |
@connectdotz Thanks for your answer and the explanation! Maybe it is an idea to document that behaviour in the README? The setup wizard was the one that guided me to the right config 🚀. The only thing that it had wrong was the |
Here is the minimum needed configuration on Linux: {
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"args": [
"--config",
"jest.config.js",
],
"env": {
"NODE_OPTIONS": "--experimental-vm-modules"
},
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/node_modules/.bin/jest"
} |
And on Windows: {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"args": [
"--config",
"jest.config.js",
],
"env": {
"NODE_OPTIONS": "--experimental-vm-modules"
},
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js"
}
]
} |
Problem description
The
jest.jestCommandLine
setting is not used in the debugger. As a result, the--experimental-vm-modules
is not passed to the debugger, and I cannot debug ECMAScript packages (see video below). I can solve this by creating a new debug configuration withinlaunch.json
while adding the"NODE_OPTIONS": "--experimental-vm-modules"
item as an environmental variable. I, however, wanted to report it since I could not find documentation on where thejest.jestCommandLine
is used and not used. Maybe we should update the documentation to make people aware of this behaviour.jest_test.mp4
Environment
vscode-jest version
: v4.6.0.node -v
: v18.9.1.npm -v
oryarn --version
: 8.19.1npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):npm ls jest
.node --experimental-vm-modules node_modules/jest/bin/jest.js
.Prerequisite
npm run test
ornode_modules/.bin/jest
):npm run test
,npm test
andjest
.Steps to Reproduce
"jest.jestCommandLine": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
to yoursettings.json
file.launch.json
item.vscode-jest-test.v2
terminal and see the following error code:Expected Behavior
It should run with the
--experimental-vm-modules
flag and should therefore successfully stop at the breakpoint.Actual Behavior
Instead, the
jest.jestCommandLine
doesn't seem to be applied when using the debugger.Current fix
I was able to fix this behaviour by creating a new test configuration in the
launch.json
file while adding the"NODE_OPTIONS": "--experimental-vm-modules"
item to the environmental variables.I can also specify another config using the following debug config:
The text was updated successfully, but these errors were encountered: