GeezerVison is showing github.com — test_runner: use run() argument names in parseCommandLine() · nodejs/node@e3378f0
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/main/test_runner.js +6-20Lines changed: 6 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,32 +22,18 @@ let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => { | 22 | 22 | prepareMainThreadExecution(false); | 23 | 23 | markBootstrapComplete(); | 24 | 24 |
| 25 | | -const { | 26 | | - perFileTimeout, | 27 | | - runnerConcurrency, | 28 | | - shard, | 29 | | - watchMode, | 30 | | -} = parseCommandLine(); | 31 | | - | 32 | | -let concurrency = runnerConcurrency; | 33 | | -let inspectPort; | | 25 | +const options = parseCommandLine(); | 34 | 26 |
| 35 | 27 | if (isUsingInspector()) { | 36 | 28 | process.emitWarning('Using the inspector with --test forces running at a concurrency of 1. ' + | 37 | 29 | 'Use the inspectPort option to run with concurrency'); | 38 | | - concurrency = 1; | 39 | | - inspectPort = process.debugPort; | | 30 | + options.concurrency = 1; | | 31 | + options.inspectPort = process.debugPort; | 40 | 32 | } | 41 | 33 |
| 42 | | -const options = { | 43 | | - concurrency, | 44 | | - inspectPort, | 45 | | - watch: watchMode, | 46 | | - setup: setupTestReporters, | 47 | | - timeout: perFileTimeout, | 48 | | - shard, | 49 | | - globPatterns: ArrayPrototypeSlice(process.argv, 1), | 50 | | -}; | | 34 | +options.setup = setupTestReporters; | | 35 | +options.globPatterns = ArrayPrototypeSlice(process.argv, 1); | | 36 | + | 51 | 37 | debug('test runner configuration:', options); | 52 | 38 | run(options).on('test:fail', (data) => { | 53 | 39 | if (data.todo === undefined || data.todo === false) { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -84,7 +84,7 @@ const { | 84 | 84 | sourceMaps, | 85 | 85 | testNamePatterns, | 86 | 86 | testSkipPatterns, | 87 | | - testOnlyFlag, | | 87 | + only: testOnlyFlag, | 88 | 88 | updateSnapshots, | 89 | 89 | } = parseCommandLine(); | 90 | 90 | let kResistStopPropagation; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js +17-17Lines changed: 17 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -197,19 +197,19 @@ function parseCommandLine() { | 197 | 197 | const forceExit = getOptionValue('--test-force-exit'); | 198 | 198 | const sourceMaps = getOptionValue('--enable-source-maps'); | 199 | 199 | const updateSnapshots = getOptionValue('--test-update-snapshots'); | 200 | | - const watchMode = getOptionValue('--watch'); | | 200 | + const watch = getOptionValue('--watch'); | 201 | 201 | const isChildProcess = process.env.NODE_TEST_CONTEXT === 'child'; | 202 | 202 | const isChildProcessV8 = process.env.NODE_TEST_CONTEXT === 'child-v8'; | | 203 | + let concurrency; | 203 | 204 | let coverageExcludeGlobs; | 204 | 205 | let coverageIncludeGlobs; | 205 | 206 | let destinations; | 206 | | - let perFileTimeout; | | 207 | + let only; | 207 | 208 | let reporters; | 208 | | - let runnerConcurrency; | | 209 | + let shard; | 209 | 210 | let testNamePatterns; | 210 | 211 | let testSkipPatterns; | 211 | | - let testOnlyFlag; | 212 | | - let shard; | | 212 | + let timeout; | 213 | 213 |
| 214 | 214 | if (isChildProcessV8) { | 215 | 215 | kBuiltinReporters.set('v8-serializer', 'internal/test_runner/reporter/v8-serializer'); | @@ -239,9 +239,9 @@ function parseCommandLine() { | 239 | 239 | } | 240 | 240 |
| 241 | 241 | if (isTestRunner) { | 242 | | - perFileTimeout = getOptionValue('--test-timeout') || Infinity; | 243 | | - runnerConcurrency = getOptionValue('--test-concurrency') || true; | 244 | | - testOnlyFlag = false; | | 242 | + timeout = getOptionValue('--test-timeout') || Infinity; | | 243 | + concurrency = getOptionValue('--test-concurrency') || true; | | 244 | + only = false; | 245 | 245 | testNamePatterns = null; | 246 | 246 |
| 247 | 247 | const shardOption = getOptionValue('--test-shard'); | @@ -262,10 +262,10 @@ function parseCommandLine() { | 262 | 262 | }; | 263 | 263 | } | 264 | 264 | } else { | 265 | | - perFileTimeout = Infinity; | 266 | | - runnerConcurrency = 1; | | 265 | + timeout = Infinity; | | 266 | + concurrency = 1; | 267 | 267 | const testNamePatternFlag = getOptionValue('--test-name-pattern'); | 268 | | - testOnlyFlag = getOptionValue('--test-only'); | | 268 | + only = getOptionValue('--test-only'); | 269 | 269 | testNamePatterns = testNamePatternFlag?.length > 0 ? | 270 | 270 | ArrayPrototypeMap( | 271 | 271 | testNamePatternFlag, | @@ -284,21 +284,21 @@ function parseCommandLine() { | 284 | 284 | globalTestOptions = { | 285 | 285 | __proto__: null, | 286 | 286 | isTestRunner, | | 287 | + concurrency, | 287 | 288 | coverage, | 288 | 289 | coverageExcludeGlobs, | 289 | 290 | coverageIncludeGlobs, | | 291 | + destinations, | 290 | 292 | forceExit, | 291 | | - perFileTimeout, | 292 | | - runnerConcurrency, | | 293 | + only, | | 294 | + reporters, | 293 | 295 | shard, | 294 | 296 | sourceMaps, | 295 | | - testOnlyFlag, | 296 | 297 | testNamePatterns, | 297 | 298 | testSkipPatterns, | | 299 | + timeout, | 298 | 300 | updateSnapshots, | 299 | | - reporters, | 300 | | - destinations, | 301 | | - watchMode, | | 301 | + watch, | 302 | 302 | }; | 303 | 303 |
| 304 | 304 | return globalTestOptions; | |
|