Skip to content

Commit

Permalink
fix #342 set child process debug port to available — replace process.…
Browse files Browse the repository at this point in the history
…execArgv in tests instead of local option
  • Loading branch information
develar committed Jun 20, 2016
1 parent 81c8e0b commit 00ea657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Api.prototype._run = function (files, _options) {
};

Api.prototype.computeForkExecArgs = function (files) {
var execArgv = this.options.testOnlyExecArgv || process.execArgv;
var execArgv = process.execArgv;
var debugArgIndex = -1;

// --debug-brk is used in addition to --inspect to break on first line and wait
Expand Down
7 changes: 6 additions & 1 deletion test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,9 @@ function generatePassDebugTests(execArgv, expectedInspectIndex) {
test('pass ' + execArgv.join(' ') + ' to fork', function (t) {
t.plan(expectedInspectIndex === -1 ? 3 : 2);

var api = new Api({testOnlyExecArgv: execArgv});
var oldExecArgv = process.execArgv;
process.execArgv = execArgv;
var api = new Api();
return api.computeForkExecArgs(['foo.js'])
.then(function (result) {
t.true(result.length === 1);
Expand All @@ -1037,6 +1039,9 @@ function generatePassDebugTests(execArgv, expectedInspectIndex) {
} else {
t.true(/--inspect=\d+/.test(result[0][expectedInspectIndex]));
}
})
.finally(function () {
process.execArgv = oldExecArgv;
});
});
}
Expand Down

0 comments on commit 00ea657

Please sign in to comment.