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

Function createTestTree

lib/internal/test_runner/harness.js:44–116  ·  view source on GitHub ↗
(rootTestOptions, globalOptions)

Source from the content-addressed store, hash-verified

42testResources.set(reporterScope.asyncId(), reporterScope);
43
44function createTestTree(rootTestOptions, globalOptions) {
45 const buildPhaseDeferred = PromiseWithResolvers();
46 const isFilteringByName = globalOptions.testNamePatterns ||
47 globalOptions.testSkipPatterns;
48 const isFilteringByOnly = (globalOptions.isolation === 'process' || process.env.NODE_TEST_CONTEXT) ?
49 globalOptions.only : true;
50 const isFilteringByTags = globalOptions.testTagFilters != null;
51 const harness = {
52 __proto__: null,
53 buildPromise: buildPhaseDeferred.promise,
54 buildSuites: [],
55 isWaitingForBuildPhase: false,
56 watching: false,
57 config: globalOptions,
58 coverage: null,
59 resetCounters() {
60 harness.counters = {
61 __proto__: null,
62 tests: 0,
63 failed: 0,
64 passed: 0,
65 cancelled: 0,
66 skipped: 0,
67 todo: 0,
68 topLevel: 0,
69 suites: 0,
70 };
71 },
72 success: true,
73 counters: null,
74 shouldColorizeTestFiles: shouldColorizeTestFiles(globalOptions.destinations),
75 teardown: null,
76 snapshotManager: null,
77 previousRuns: null,
78 isFilteringByName,
79 isFilteringByOnly,
80 isFilteringByTags,
81 async runBootstrap() {
82 if (globalSetupExecuted) {
83 return PromiseResolve();
84 }
85 globalSetupExecuted = true;
86 const globalSetupFunctions = await setupGlobalSetupTeardownFunctions(
87 globalOptions.globalSetupPath,
88 globalOptions.cwd,
89 );
90 harness.globalTeardownFunction = globalSetupFunctions.globalTeardownFunction;
91 if (typeof globalSetupFunctions.globalSetupFunction === 'function') {
92 return globalSetupFunctions.globalSetupFunction();
93 }
94 return PromiseResolve();
95 },
96 async waitForBuildPhase() {
97 if (harness.buildSuites.length > 0) {
98 await SafePromiseAllReturnVoid(harness.buildSuites);
99 }
100
101 buildPhaseDeferred.resolve();

Callers 2

runFunction · 0.85
lazyBootstrapRootFunction · 0.85

Calls 3

shouldColorizeTestFilesFunction · 0.85
setupProcessStateFunction · 0.85
hrtimeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…