-
Notifications
You must be signed in to change notification settings - Fork 1.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
Debugger support #342
Comments
What Node.js version are you on? |
v5.1.1 (from the Debian experimental repository). Simple debugging works:
|
We definitely want to support using the debugger, but not really sure from the top of my head what's preventing it. We'll look into it. Thanks for reporting @hberntsen :) @jamestalmage might have a better idea.
I thought https://github.com/sindresorhus/ava/blob/df48ce69b841c8b5fb1f522aa435d3a676876078/lib/babel.js#L26-L37 did that for us. // @novemberborn
Any downside adding this to AVA? |
That is going to be additionally problematic since AVA will potentially spawn a number of processes at once if you have multiple test files.
I think this is separate from remapping coverage/sourcemaps.
Only the multiple process issue. Can we detect if the debugger is in use and enforce serial execution of the test files? |
Chrome DevToools use source maps to adjusts breakpoints too, so I just assumed this would do that too.
Maybe, but I think it would be better to be explicit about it. I think it would be worth introducing a |
+1! |
We, JetBrains, cannot support debug AVA tests without changes on your side. I will send you pull request next week. General information — https://intellij-support.jetbrains.com/hc/en-us/community/posts/206193339-Debugging-node-child-processes?page=1#community_comment_206895729 My solution — https://github.com/sindresorhus/ava/compare/master...develar:debug?expand=1 (not yet reviewed by my experienced college). Please note — babel debug in JetBrains IDE is broken in node 5.x, I use my custom build of node 5.x (nodejs/node#4231). |
Another problem on AVA side: CachingPrecompiler produces source map, but... debug doesn't work in any case because generated source file doesn't contain So, IDE cannot map source file to transpired because no Yes, it is very strange that babel does so, I found related issue — babel/grunt-babel#13 This change will be also in my pull request. For now, you can set Please note again — babel debug in JetBrains IDE is broken in node 5.x, I use my custom build of node 5.x (nodejs/node#4231). Also, to speed up, enable lazy compilation — nodejs/node#877 (comment) After set sourceMaps to |
I'd love to see an addition to the readme on how to use the debugger for new users. :) |
…cess.execArgv in tests instead of local option
Replacing unshift with push allows to users to have expected order of argumets relates to avajs/ava#342
The issue is still open - does it mean that it's still impossible to debug AVA tests in IDEA or Webstorm ? |
@azakordonets or VS Code? |
@JimmyBoh i prefer products from Intellij :) |
@JimmyBoh Only WebStorm currently provides the best AVA debug. #874 (comment) @azakordonets Please see #874 I hope it will be accepted soon. |
@develar Thanks a lot :) I've subscribed for that issue |
The README.md gives me the impression that debugging of tests is possible with the --serial option. It looks like this option is designed for debugging ava itself though.
I tried debugging tests in the following way:
ava --init
npm install signal-exit
Based on add covenience util for debugging #225, put the following code in
node_modules/ava/debug.js
Make a simple test with a debugger keyword:
node debug node_modules/ava/debug.js " {\"file\":\"path/to/test.js\",\"failFast\":false,\"serial\":true,\"require\":[]} "
When running this via the node debugger (or node inspector) the breakpoint is not triggered, possibly due to the code transformations via babel.
Since ava spawns new processes, debugging cli.js directly is not possible. The new node processes try to listen to the same debug port and thus crash with
EADDRINUSE :::5858
. By hacking fork.js and addingoptions['execArgv'] = ['--debug-brk=5860'];
I could attach node inspector to this port but it still failed to trigger my breakpoint within the test.Is there any way to use a debugger for my tests?
The text was updated successfully, but these errors were encountered: