MCPcopy Index your code
hub / github.com/nodejs/node / parseCommandLine

Function parseCommandLine

lib/internal/test_runner/utils.js:241–445  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239let globalTestOptions;
240
241function parseCommandLine() {
242 if (globalTestOptions) {
243 return globalTestOptions;
244 }
245
246 const isTestRunner = getOptionValue('--test');
247 const coverage = getOptionValue('--experimental-test-coverage');
248 const forceExit = getOptionValue('--test-force-exit');
249 const sourceMaps = getOptionValue('--enable-source-maps');
250 const updateSnapshots = getOptionValue('--test-update-snapshots');
251 const watch = getOptionValue('--watch');
252 const timeout = getOptionValue('--test-timeout') || Infinity;
253 let randomize = getOptionValue('--test-randomize');
254 const hasRandomSeedOption = getOptionValue('[has_test_random_seed]');
255 const randomSeedOption = getOptionValue('--test-random-seed');
256 let randomSeed;
257 const rerunFailuresFilePath = getOptionValue('--test-rerun-failures');
258 const isChildProcess = process.env.NODE_TEST_CONTEXT === 'child';
259 const isChildProcessV8 = process.env.NODE_TEST_CONTEXT === 'child-v8';
260 let globalSetupPath;
261 let concurrency;
262 let coverageExcludeGlobs;
263 let coverageIncludeGlobs;
264 let lineCoverage;
265 let branchCoverage;
266 let functionCoverage;
267 let destinations;
268 let isolation;
269 let only = getOptionValue('--test-only');
270 let reporters;
271 let shard;
272 let testNamePatterns = mapPatternFlagToRegExArray('--test-name-pattern');
273 let testSkipPatterns = mapPatternFlagToRegExArray('--test-skip-pattern');
274 let testTagFilters = null;
275 let testTagFilterExpressions = null;
276
277 if (isChildProcessV8) {
278 kBuiltinReporters.set('v8-serializer', 'internal/test_runner/reporter/v8-serializer');
279 reporters = ['v8-serializer'];
280 destinations = [kDefaultDestination];
281 } else if (isChildProcess) {
282 reporters = ['tap'];
283 destinations = [kDefaultDestination];
284 } else {
285 destinations = getOptionValue('--test-reporter-destination');
286 reporters = getOptionValue('--test-reporter');
287 globalSetupPath = getOptionValue('--test-global-setup');
288 if (reporters.length === 0 && destinations.length === 0) {
289 ArrayPrototypePush(reporters, kDefaultReporter);
290 }
291
292 if (reporters.length === 1 && destinations.length === 0) {
293 ArrayPrototypePush(destinations, kDefaultDestination);
294 }
295
296 if (destinations.length !== reporters.length) {
297 throw new ERR_INVALID_ARG_VALUE(
298 '--test-reporter',

Callers 3

runFunction · 0.70
lazyBootstrapRootFunction · 0.70
test_runner.jsFile · 0.50

Calls 9

getOptionValueFunction · 0.85
emitExperimentalWarningFunction · 0.85
convertStringToRegExpFunction · 0.85
getReportersMapFunction · 0.85
composeFunction · 0.85
setMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…