Skip to content
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

Using child_process fork without customized Argv breaks debugging #53

Closed
rsxdalv opened this issue Jul 6, 2017 · 2 comments
Closed

Comments

@rsxdalv
Copy link
Contributor

rsxdalv commented Jul 6, 2017

nodejs/node#8495
Without proper handling, the CP simply receives the same arguments, and thus you get it to receive the same argv as node, hence you get it to try and listen on the same port for debugger/inspector. All in all, making gulp & gulp-spawn-mocha debugging infeasible if not impossible.

This plugin has built in support for istanbul and better error handling (not throwing up stderr dump every time a test case fails); however, is far less debugging friendly.

@rsxdalv
Copy link
Contributor Author

rsxdalv commented Jul 6, 2017

Currently trying to use:
this._child = proc.fork(bin, args.concat(this._files), {cwd: cwd, env: env, execPath: execPath, silent: !!output, execArgv: []});

@rsxdalv
Copy link
Contributor Author

rsxdalv commented Jul 6, 2017

It works in the sense that you can then

.pipe(mocha({
            "require": "./utils/mocha.js",
            "reporter": argv.reporter || undefined,
            "debug": argv["debug-mocha"] || false,
            "inspect": debug_brk ? argv["inspect-mocha"] || undefined : undefined,
            "debug-brk": debug_brk,
        }, null));

However, clunkiness ensues as you cannot actually pass the port as it is interpreted as a test file (I believe gulp-mocha handles this for the user), instead forcing you to pass the --inspect=port manually, I fear something like so:

.pipe(mocha({
            "require": "./utils/mocha.js",
            "reporter": argv.reporter || undefined,
            "debug": argv["debug-mocha"] || false,
            "inspect=9239": true,  // This will, unfortunately, be seen as test file
            "debug-brk": debug_brk,
        }, null));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants