| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ed1ede8 commit 69c78ca
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,7 @@ const { | |||
| 10 | 10 | } = require('internal/process/pre_execution'); | |
| 11 | 11 | const { isUsingInspector } = require('internal/util/inspector'); | |
| 12 | 12 | const { run } = require('internal/test_runner/runner'); | |
| 13 | - const { | ||
| 14 | - parseCommandLine, | ||
| 15 | - setupTestReporters, | ||
| 16 | - } = require('internal/test_runner/utils'); | ||
| 13 | + const { parseCommandLine } = require('internal/test_runner/utils'); | ||
| 17 | 14 | const { exitCodes: { kGenericUserError } } = internalBinding('errors'); | |
| 18 | 15 | let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => { | |
| 19 | 16 | debug = fn; | |
@@ -31,7 +28,6 @@ if (isUsingInspector()) { | |||
| 31 | 28 | options.inspectPort = process.debugPort; | |
| 32 | 29 | } | |
| 33 | 30 | ||
| 34 | - options.setup = setupTestReporters; | ||
| 35 | 31 | options.globPatterns = ArrayPrototypeSlice(process.argv, 1); | |
| 36 | 32 | ||
| 37 | 33 | debug('test runner configuration:', options); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,6 @@ const { kCancelledByParent, Test, Suite } = require('internal/test_runner/test') | |||
| 21 | 21 | const { | |
| 22 | 22 | parseCommandLine, | |
| 23 | 23 | reporterScope, | |
| 24 | - setupTestReporters, | ||
| 25 | 24 | shouldColorizeTestFiles, | |
| 26 | 25 | } = require('internal/test_runner/utils'); | |
| 27 | 26 | const { queueMicrotask } = require('internal/process/task_queues'); | |
@@ -231,13 +230,14 @@ function lazyBootstrapRoot() { | |||
| 231 | 230 | __proto__: null, | |
| 232 | 231 | entryFile: process.argv?.[1], | |
| 233 | 232 | }; | |
| 234 | - createTestTree(rootTestOptions, parseCommandLine()); | ||
| 233 | + const globalOptions = parseCommandLine(); | ||
| 234 | + createTestTree(rootTestOptions, globalOptions); | ||
| 235 | 235 | globalRoot.reporter.on('test:fail', (data) => { | |
| 236 | 236 | if (data.todo === undefined || data.todo === false) { | |
| 237 | 237 | process.exitCode = kGenericUserError; | |
| 238 | 238 | } | |
| 239 | 239 | }); | |
| 240 | - globalRoot.harness.bootstrapPromise = setupTestReporters(globalRoot.reporter); | ||
| 240 | + globalRoot.harness.bootstrapPromise = globalOptions.setup(globalRoot.reporter); | ||
| 241 | 241 | } | |
| 242 | 242 | return globalRoot; | |
| 243 | 243 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -573,6 +573,7 @@ function run(options = kEmptyObject) { | |||
| 573 | 573 | // parseCommandLine() should not be used here. However, The existing run() | |
| 574 | 574 | // behavior has relied on it, so removing it must be done in a semver major. | |
| 575 | 575 | ...parseCommandLine(), | |
| 576 | + setup, // This line can be removed when parseCommandLine() is removed here. | ||
| 576 | 577 | }; | |
| 577 | 578 | const root = createTestTree(rootTestOptions, globalOptions); | |
| 578 | 579 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -176,15 +176,6 @@ async function getReportersMap(reporters, destinations) { | |||
| 176 | 176 | } | |
| 177 | 177 | ||
| 178 | 178 | const reporterScope = new AsyncResource('TestReporterScope'); | |
| 179 | - const setupTestReporters = reporterScope.bind(async (rootReporter) => { | ||
| 180 | - const { reporters, destinations } = parseCommandLine(); | ||
| 181 | - const reportersMap = await getReportersMap(reporters, destinations); | ||
| 182 | - for (let i = 0; i < reportersMap.length; i++) { | ||
| 183 | - const { reporter, destination } = reportersMap[i]; | ||
| 184 | - compose(rootReporter, reporter).pipe(destination); | ||
| 185 | - } | ||
| 186 | - }); | ||
| 187 | - | ||
| 188 | 179 | let globalTestOptions; | |
| 189 | 180 | ||
| 190 | 181 | function parseCommandLine() { | |
@@ -281,6 +272,15 @@ function parseCommandLine() { | |||
| 281 | 272 | coverageIncludeGlobs = getOptionValue('--test-coverage-include'); | |
| 282 | 273 | } | |
| 283 | 274 | ||
| 275 | + const setup = reporterScope.bind(async (rootReporter) => { | ||
| 276 | + const reportersMap = await getReportersMap(reporters, destinations); | ||
| 277 | + | ||
| 278 | + for (let i = 0; i < reportersMap.length; i++) { | ||
| 279 | + const { reporter, destination } = reportersMap[i]; | ||
| 280 | + compose(rootReporter, reporter).pipe(destination); | ||
| 281 | + } | ||
| 282 | + }); | ||
| 283 | + | ||
| 284 | 284 | globalTestOptions = { | |
| 285 | 285 | __proto__: null, | |
| 286 | 286 | isTestRunner, | |
@@ -292,6 +292,7 @@ function parseCommandLine() { | |||
| 292 | 292 | forceExit, | |
| 293 | 293 | only, | |
| 294 | 294 | reporters, | |
| 295 | + setup, | ||
| 295 | 296 | shard, | |
| 296 | 297 | sourceMaps, | |
| 297 | 298 | testNamePatterns, | |
@@ -480,7 +481,6 @@ module.exports = { | |||
| 480 | 481 | kDefaultPattern, | |
| 481 | 482 | parseCommandLine, | |
| 482 | 483 | reporterScope, | |
| 483 | - setupTestReporters, | ||
| 484 | 484 | shouldColorizeTestFiles, | |
| 485 | 485 | getCoverageReport, | |
| 486 | 486 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments