-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Debugging in Visual Studio Code does not work unless you use --legacy-bundling #2736
Comments
Maybe you'll find this thread interesting? #1652 |
Also cc: @orta |
Unfortunately, his config doesn't work at all for me: Debugger listening on port 5858
c:\github\debug-jest-in-vscode\node_modules\.bin\jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.runMain [as _onTimeout] (module.js:441:10)
at Timer.listOnTimeout (timers.js:92:15) I have a feeling that it is because I am working from a Windows machine. I had to switch the second I believe that our configs are largely the same but written in different ways. For example, At this point, I have it working with:
What I am concerned about is that Jest functions differently with |
Just did some more playing and found that using |
Interesting, have you tried yarn too? |
I hadn't before, but yes the issue appears when using yarn as well. I'm still blown away that --global-style made a difference. With only one dependency, it doesn't seem like there would be much of a difference between having Jest's deps in a child folder vs a sibling folder. I think I'm going to try a different version of Node and see if that changes things. I use 4 because I've been doing a lot of AWS Lambda stuff and they're still stuck on 4 for now. I would expect this to change to 6 soon as LTS for 4 changes to maintenance in April. |
Found it! I contacted NPM and they told me to try moving the module folders one by one and see if I could track down what module was causing the issue. I wrote a program to do this for me and narrowed it down to Now that I had the potential source, I removed the This only happens when using So, anyway... the problem seems to start here. |
This is actually expected behaviour for Jest. That's why we advise to install Maybe we could warn better about this? |
But what you are proposing will break it. I AM using NPM 4 and the expected behavior leads to breakpoints and debugging being broken in VSCode. |
So you include |
I tried doing exactly as you say just to double check. Yes, it's still broken. What you are proposing will force it to always be broken. Consistency, yes... but not the desired outcome. What I've been saying all along is that by NOT flattening, VSCode's debugger will work without issue. Flattening breaks things. |
Any thoughts? |
@orta can you advise on the next steps here? Anything we need to do? |
I'm not sure there's anything we can do here TBH, other than recommend people update node if they're having this specific issue. |
For anyone interested - I think I have a simple fix for this. I commented on the VS Code issue here: microsoft/vscode#19566 (comment) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Jest debugging in Visual Studio Code does not work unless you use
npm install --legacy-bundling
.This was a fun one to track down. I was not able to get Jest to debug properly to work on my primary laptop and, after several hours of mucking with it, I tried my second laptop. It worked! After comparing differences, I noticed npm was way out of date and ultimately I discovered the hack below.
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.npm install
, put a breakpoint on__tests__/sum-test.js:2
, and run.What I see is, even though I have the
sum-test.js
file open, a new tab labeledc:\github\debug-jest-in-vscode\__tests__\sum-test.js
is opened (note: I cloned toC:\github\debug-jest-in-vscode
). If you hover over the tab, the full path it shows is\1000\c:\github\debug-jest-in-vscode\__tests__\sum-test.js
. Also, my code is wrapped with({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){
+}});
. The breakpoint is still respected and the program stops in the correct spot; however, neither placing new breakpoints nor editing code in the mystery tab seems to work.Now, to get it to work:
node_modules
folder entirely.npm install --legacy-bundling
, put a breakpoint on__tests__/sum-test.js:2
, and run.Now everything works as expected. Breakpoints cause my program to pause in the original source file, the source file is the same, and I can edit the source file while paused.
What is the expected behavior?
I would expect
npm install
's--legacy-bundling
not to be needed.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest: 18.1.0
Node: 4.6.0
NPM: 4.2.0
OS: Windows 10 Home (Windows_NT ia32 10.0.14393)
Note: I created an issue for VSCode team as well to hopefully get some dialog going.
The text was updated successfully, but these errors were encountered: