-
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
fix #342 set child process debug port to available #613
Conversation
Tip for reviewing this, append |
@@ -18,6 +18,7 @@ var AvaError = require('./lib/ava-error'); | |||
var fork = require('./lib/fork'); | |||
var formatter = require('./lib/enhance-assert').formatter(); | |||
var CachingPrecompiler = require('./lib/caching-precompiler'); | |||
var getPort = require('get-port'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be placed above the relative requires (on line 17).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Nice! Thanks for working on this @develar :) |
Can you add some tests? |
What's the benefit of this? |
My first approach was just add |
It's used as of a few hours ago 😜 https://github.com/sindresorhus/ava/blob/1868204c1901f45b4f66a520ef6486fdd71fe1d2/api.js#L210 |
tests[index] = forkManager; | ||
forkManager.on('stats', tryRun); | ||
}) | ||
.catch(function (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is asynchronous whereas onForkStarting
is not. Probably best to build up tests
similarly (and synchronously) to how it was done before and leave the rest of the code as it is. (Note that I just changed this you so you'll need to rebase).
You might be able to solve this with |
Hey @develar, would be great to have debug support for IntelliJ. Will you have time to follow up on the feedback here? |
@novemberborn Sorry for delay, it will be addressed this week. |
@develar no worries, that's great! 👍 |
Closing due to lack of response from the author of PR. |
@develar - If you ever get around to updating this PR, we would still be interested in merging. However, be aware, there is work happening towards official Node debugger support: nodejs/node#2546 (comment). |
New PR — #874. |
We decided to support AVA debug (#342) without any efforts on your side.
But:
=0
, and when will be supported, it will take time to be available for users in the generally available release.Unfortunately, although idea of fix is very simple (
getPort().then
), change is complex because existing code adds custom context-dependent methods to Promise. And Github diff view is very unclear compared to IntelliJ IDEA.What's done:
debug-brk=
ordebug=
in the main process args, find available port and change debug arg.fork
now returns object with custom methods (on
,run
) andpromise
field. We don't add custom methods topromise
anymore.then
added to returned object. Test-only — in production we usepromise
field.send
is not used, as far I see, but I didn't delete it. Should I do it?Please note — as it stated in my comment, debugging will be still not possible due to another issues. Solving
sourcemap
issue is out of this PR scope.PS: AVA is so awesome, that multi-process debug was reimplemented in the IntelliJ JS Debugger to avoid multiple debug tabs (IntelliJ Platform 146+).