Closed haughki closed 2 years ago
maybe this happens because of your remote wsl connection?
can you use the vanilla debug feature from vscode. the addon is just executing that.
tl;dr At this point, I don't really see this as a Jest Runner issue. See details below. I would like to see if I can sort out the weird terminal issue I describe below, and then post back to this thread. I can't remember if I can still post to the thread after you close the issue: if so, feel free to close it and I'll circle back when I get it sorted. Else, maybe you could leave open for a week -- I'll plan to figure this out in the next few days.
can you use the vanilla debug feature from vscode. the addon is just executing that.
Yes. After adding a babel.config.js to the root:
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"babel-preset-react-app",
],
}
I can attach the debugger and break running :~/projects/my-app (master)$ ./node_modules/.bin/jest --runInBand /home/xxxxxx/projects/my-app/src/supporting/__test__/MyClass.test.js -t testing
The actual jest command:
home/xxxxxx/.nvm/versions/node/v18.7.0/bin/node node_modules/.bin/jest /home/xxxxxx/projects/my-app/src/supporting/__test__/MyClass.test.js -t testing --runInBand
is looking for node_modules/.bin/jest
assuming the cwd is the project root, but the terminal is in my home dir. Hence: Error: Cannot find module '/home/xxxxxx/node_modules/.bin/jest'
So, I think that if the jest command was an abs path, it would fix the bug, sortof....
But, Jest Runner is already trying to cd
the terminal into the project root; the cd
just isn't happening 'in time'. This seems to have more to do with the 'start up' of the two terminals. Meaning:
cd /home/xxxxxx/projects/my-app ;
especially in the 'Debug Jest Tests' terminal:
So. It works, just not on the first run. I wonder why things are getting so munged on that first run: looks sorta like a timing thing -- that the terminals are taking too long to start. Maybe has something to do with my .bashrc that runs when the term opens (that's where the 'wsl-vpnkit' is coming from)...? But, if so, that seems like a bug (somewhere) in it's own right; i.e., a new terminal should be able to run a .bashrc to set itself up before whatever else happens, right?
This was because of a line in my .bashrc:
# go home. This because of a bug in winterm settings: https://github.com/microsoft/WSL/issues/6995
~
I was telling my shell to cd to the home directory at the end of .bashrc because of an old WSL bug that I had 'fixed' with this tilde. Removing the line fixes the problem of the JS debugger looking for jest in the wrong place, etc.
Thank you for this fantastic plugin!!
Type: Bug
WSL 2 Ubuntu 20.04.4 LTS nvm 0.39.1 node v18.7.0 npm 8.15.0
Disabled all but these three VSCode extensions: remote-wsl|ms-|0.66.3 vscode-remote-extensionpack|ms-|0.21.0 vscode-jest-runner|fir|0.4.48
To Reproduce
Expected The test runs in the terminal
Actual A 'jest' terminal starts in the TERMINAL tab on the bottom pane. It tries to cd into the workspace dir before the command prompt is ready, and ends up in the home directory:
Then, a "Debug Jest Tests" terminal starts, and runs the following commands which result in the error:
Expected The test should run and break on the breakpoint
Actual The terminal spawn again as above, and I get the following:
The terminal just hangs at this point, the test never runs, breakpoint never hit.
VS Code version: Code 1.70.1 (6d9b74a70ca9c7733b29f0456fd8195364076dda, 2022-08-10T06:08:33.642Z) OS version: Windows_NT x64 10.0.19042 Modes: Remote OS version: Linux x64 5.4.72-microsoft-standard-WSL2 Remote OS version: Linux x64 5.4.72-microsoft-standard-WSL2
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz (8 x 1896)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.81GB (0.98GB free)| |Process Argv|--file-uri=vscode-remote://wsl+Ubuntu/home/xxxxxx/projects/vsc_test_bug/NO_REG2.code-workspace --remote=wsl+Ubuntu --crash-reporter-id ea39c7bc-9acf-4ab0-a8de-b9cec0c6fcb0| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.4.72-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz (4 x 1896)| |Memory (System)|2.92GB (0.22GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.4.72-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz (4 x 1896)| |Memory (System)|2.92GB (0.22GB free)| |VM|0%|
Extensions (3)
Extension|Author (truncated)|Version ---|---|--- remote-wsl|ms-|0.66.3 vscode-remote-extensionpack|ms-|0.21.0 vscode-jest-runner|fir|0.4.48