-
Notifications
You must be signed in to change notification settings - Fork 293
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
Unable to debug in VSCode in CRA sample using node manager (fnm) #1022
Comments
hi @jpierson-at-riis, I tried a fresh cra on MacOS. There didn't seem to be any problem debugging and stopping at the breakpoint at the You might be able to fix it by customizing the launch.json if the generated debug config is not working due to env related issues. Can you find the generated debug config from the vscode-jest output terminal? When you try to debug the first time, if there is no existing debug config ("vscode-jest-tests.v2", for example), it will auto-generate one and output it in the terminal like this: [info] auto config debug config:
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"args": [
"test",
"--",
"test",
"--runInBand",
"--watchAll=false",
"--testNamePattern",
"${jest.testNamePattern}",
"--runTestsByPath",
"${jest.testFile}"
],
"cwd": "/testing/cra-2023-04-30",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"runtimeExecutable": "npm",
"protocol": "inspector"
} You can copy/paste it to your launch.json and try to use the full path for npm in the "runtimeExecutable". This workaround is kind of a hack, I'm sure a correctly configured env should be able to find the npm without the full path. But I don't have enough context for your env, so you might want to investigate further in your env for the actual root cause. Let me know if you have any other questions. |
I'm returning to this project so I'll retry this after I've updated everything. |
I've picked this up and tried some of the discussion options and solutions again but I'm still running into the same errors even after VSCode has added support for FNM. I've also tried various configurations of the Example of specifying powershell with the default profile which includes
Example of specifying fnm directly similar to how I've attempted to set up a launch profile in the past:
In all of cases I've tried so far, attempting to Debug by right clicking the test and choosing the Debug option always seems to result in the same error message.
It seems to me that when invoking the |
I've also just discovered the
Note that the Run Test option always seems to work for me with no problem. It's only the Debug Test option that seems to fail. |
@jpierson-at-riis, the debugger doesn't run in the terminal, so the terminal/shell related setting will not impact it. The control is all in the debug config "vscode-jest-tests.v2"... can you paste your custom debug config "vscode-jest-tests.v2"? I assumed you have tried the |
@connectdotz, as things go I'm working on another project at the moment which uses vitest instead. As soon as I get a chance I'll try to follow up on your suggestions. Thank you for the input! |
Environment
vscode-jest version
: v5.2.3node -v
: v18.12.0npm -v
oryarn --version
: 8.19.2npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):npm test ---
Prerequisite
npm run test
Steps to Reproduce
Expected Behavior
VSCode should start the test in debug mode and the breakpoint that had been set on step 6 above should be hit and execution should be paused at that step.
Actual Behavior
The text was updated successfully, but these errors were encountered: