Skip to content

Commit 00ea657

Browse files
committed
fix avajs#342 set child process debug port to available — replace process.execArgv in tests instead of local option
1 parent 81c8e0b commit 00ea657

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Api.prototype._run = function (files, _options) {
135135
};
136136

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

141141
// --debug-brk is used in addition to --inspect to break on first line and wait

test/api.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,9 @@ function generatePassDebugTests(execArgv, expectedInspectIndex) {
10271027
test('pass ' + execArgv.join(' ') + ' to fork', function (t) {
10281028
t.plan(expectedInspectIndex === -1 ? 3 : 2);
10291029

1030-
var api = new Api({testOnlyExecArgv: execArgv});
1030+
var oldExecArgv = process.execArgv;
1031+
process.execArgv = execArgv;
1032+
var api = new Api();
10311033
return api.computeForkExecArgs(['foo.js'])
10321034
.then(function (result) {
10331035
t.true(result.length === 1);
@@ -1037,6 +1039,9 @@ function generatePassDebugTests(execArgv, expectedInspectIndex) {
10371039
} else {
10381040
t.true(/--inspect=\d+/.test(result[0][expectedInspectIndex]));
10391041
}
1042+
})
1043+
.finally(function () {
1044+
process.execArgv = oldExecArgv;
10401045
});
10411046
});
10421047
}

0 commit comments

Comments
 (0)