mirror of
https://github.com/nodejs/node.git
synced 2026-11-15 10:36:53 -05:00
This commit consolidates all option parsing for the test runner in the parseCommandLine() internal helper function. The exception is a couple of temporary flags used for feature gating which will eventually become no-ops. This consolidation is prep work for supporting running test files in the test runner process. PR-URL: https://github.com/nodejs/node/pull/53849 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
prepareMainThreadExecution,
|
|
markBootstrapComplete,
|
|
} = require('internal/process/pre_execution');
|
|
const { isUsingInspector } = require('internal/util/inspector');
|
|
const { run } = require('internal/test_runner/runner');
|
|
const {
|
|
parseCommandLine,
|
|
setupTestReporters,
|
|
} = require('internal/test_runner/utils');
|
|
const { exitCodes: { kGenericUserError } } = internalBinding('errors');
|
|
let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => {
|
|
debug = fn;
|
|
});
|
|
|
|
prepareMainThreadExecution(false);
|
|
markBootstrapComplete();
|
|
|
|
const {
|
|
perFileTimeout,
|
|
runnerConcurrency,
|
|
shard,
|
|
watchMode,
|
|
} = parseCommandLine();
|
|
|
|
let concurrency = runnerConcurrency;
|
|
let inspectPort;
|
|
|
|
if (isUsingInspector()) {
|
|
process.emitWarning('Using the inspector with --test forces running at a concurrency of 1. ' +
|
|
'Use the inspectPort option to run with concurrency');
|
|
concurrency = 1;
|
|
inspectPort = process.debugPort;
|
|
}
|
|
|
|
const options = {
|
|
concurrency,
|
|
inspectPort,
|
|
watch: watchMode,
|
|
setup: setupTestReporters,
|
|
timeout: perFileTimeout,
|
|
shard,
|
|
};
|
|
debug('test runner configuration:', options);
|
|
run(options).on('test:fail', (data) => {
|
|
if (data.todo === undefined || data.todo === false) {
|
|
process.exitCode = kGenericUserError;
|
|
}
|
|
});
|