-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
How to properly debug tests without using the command line debugger? #2119
Comments
@alanz1223 - right now, this won't work. More info here: #1652 @cpojer has already pinged the nodejs team (nodejs/node#7593) and they've got a PR open to fix this (nodejs/node#9272) Until that time, you can use node-inspector, and set up an npm script like so: "test-debug": "./node_modules/.bin/node-debug ./node_modules/.bin/jest -i --watch" and run it like: $ npm run test-debug and even run specific tests like $ npm run test-debug -- NameOfTheTestFile |
@damonbauer thx for the links and the node-inspector help. Still, I get a "websocket_closed" inside the chrome window. Stacktrace:
Running on node |
Nevermind, it works on |
Duplicate of #1652. |
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. |
node v.7
jest 16.0.1
Currently using VSCode and I am trying to debug a very basic test but I am having great difficulty doing so. I am using the node inspect flag to use the chrome devtools but my debugger statements and breakpoints are being ignored and the test just continues to run. At this point I am considering other debugging mechanisms to run a simple GUI based debugger. Are there any alternatives that you guys have had success using?
Here are the commands I run
node --inspect --debug-brk --harmony node_modules/jest/bin/jest.js -i
As you see I include the
-i
so that the tests run within the same process.After doing this, I paste the given link into chrome and pause at the first line where jest is required, and after pressing "play" the test continues the run while ignoring the breakpoints and debugger statements and all the errors are actually logged on the shell and not the console within the devtools as one would expect.
I've been battling this issue on and off for about a week and would really like to switch to Jest as my testing framework, but that would be impossible if I can't properly debug my tests.
The text was updated successfully, but these errors were encountered: