Skip to content

Commit 7870b47

Browse files
committed
fixed issue with test run hanging indefinitely if not in debug
1 parent 2dada89 commit 7870b47

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

@bellatrix/runner/bellatrix.js

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const configs = [
9898
];
9999

100100
const configFileURI = pathToFileURL(findFilePath(configs));
101+
const debugPort = 12016;
101102

102103
let config;
103104

@@ -217,13 +218,20 @@ switch (config.frameworkSettings.testSettings.testFramework) {
217218

218219
// cliArgs.push('--ui'); // TODO: make it an option
219220

221+
const execArgv = [];
222+
const inspector = await import('inspector');
223+
224+
if (inspector.url() !== undefined) {
225+
execArgv.push(`--inspect=${debugPort}`);
226+
}
227+
220228
const child = fork(cliPath, cliArgs, {
221229
stdio: 'inherit',
222230
env: {
223231
...process.env,
224232
NODE_OPTIONS: `--loader=${tsPathsEsmLoaderPath} --experimental-specifier-resolution=node --no-warnings`,
225233
},
226-
execArgv: ['--inspect=12016'],
234+
execArgv,
227235
});
228236

229237
// Handle child process events (optional)
@@ -265,13 +273,20 @@ switch (config.frameworkSettings.testSettings.testFramework) {
265273
case 'xunit': throw new Error('Jasmine does not have xUnit reporter');
266274
}
267275

276+
const execArgv = [];
277+
const inspector = await import('inspector');
278+
279+
if (inspector.url() !== undefined) {
280+
execArgv.push(`--inspect=${debugPort}`);
281+
}
282+
268283
const child = fork(cliPath, cliArgs, {
269284
stdio: 'inherit',
270285
env: {
271286
...process.env,
272287
NODE_OPTIONS: `--loader=${tsPathsEsmLoaderPath} --experimental-specifier-resolution=node --no-warnings`,
273288
},
274-
execArgv: ['--inspect=12016'],
289+
execArgv,
275290
});
276291

277292
// Handle child process events (optional)
@@ -313,13 +328,20 @@ switch (config.frameworkSettings.testSettings.testFramework) {
313328
}
314329
}
315330

331+
const execArgv = [];
332+
const inspector = await import('inspector');
333+
334+
if (inspector.url() !== undefined) {
335+
execArgv.push(`--inspect=${debugPort}`);
336+
}
337+
316338
const child = fork(cliPath, cliArgs, {
317339
stdio: 'inherit',
318340
env: {
319341
...process.env,
320342
NODE_OPTIONS: `--loader=${tsPathsEsmLoaderPath} --experimental-specifier-resolution=node --no-warnings`,
321343
},
322-
execArgv: ['--inspect=12016'],
344+
execArgv,
323345
});
324346

325347
// Handle child process events (optional)
@@ -379,13 +401,20 @@ switch (config.frameworkSettings.testSettings.testFramework) {
379401
}
380402
}
381403

404+
const execArgv = [];
405+
const inspector = await import('inspector');
406+
407+
if (inspector.url() !== undefined) {
408+
execArgv.push(`--inspect=${debugPort}`);
409+
}
410+
382411
const child = fork(cliPath, cliArgs, {
383412
stdio: 'inherit',
384413
env: {
385414
...process.env,
386415
NODE_OPTIONS: `--loader=${tsPathsEsmLoaderPath} --experimental-vm-modules --no-warnings`,
387416
},
388-
execArgv: ['--inspect=12016'],
417+
execArgv,
389418
});
390419

391420
// Handle child process events (optional)

0 commit comments

Comments
 (0)