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

Method run

lib/internal/test_runner/test.js:1842–1886  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1840 }
1841
1842 async run() {
1843 this.computeInheritedHooks();
1844 const hookArgs = this.getRunArgs();
1845
1846 let stopPromise;
1847 const after = runOnce(() => this.runHook('after', hookArgs), kRunOnceOptions);
1848 try {
1849 this.parent.activeSubtests++;
1850 await this.buildSuite;
1851 this.startTime = hrtime();
1852
1853 if (this[kShouldAbort]()) {
1854 this.subtests = [];
1855 this.postRun();
1856 return;
1857 }
1858
1859 if (this.parent.hooks.before.length > 0) {
1860 await this.parent.runHook('before', this.parent.getRunArgs());
1861 }
1862
1863 await this.runHook('before', hookArgs);
1864
1865 stopPromise = stopTest(this.timeout, this.signal);
1866 const subtests = this.skipped || this.error ? [] : this.subtests;
1867 const promise = SafePromiseAll(subtests, (subtests) => subtests.start());
1868
1869 await SafePromiseRace([promise, stopPromise]);
1870 await after();
1871
1872 this.pass();
1873 } catch (err) {
1874 try { await after(); } catch { /* suite is already failing */ }
1875 if (isTestFailureError(err)) {
1876 this.fail(err);
1877 } else {
1878 this.fail(new ERR_TEST_FAILURE(err, kTestCodeFailure));
1879 }
1880 } finally {
1881 stopPromise?.[SymbolDispose]();
1882 this.#publishSuiteEnd();
1883 }
1884
1885 this.postRun();
1886 }
1887}
1888
1889function getFullName(test) {

Callers

nothing calls this directly

Calls 13

getRunArgsMethod · 0.95
#publishSuiteEndMethod · 0.95
hrtimeFunction · 0.85
stopTestFunction · 0.85
isTestFailureErrorFunction · 0.85
computeInheritedHooksMethod · 0.80
runHookMethod · 0.80
passMethod · 0.80
afterFunction · 0.50
postRunMethod · 0.45
getRunArgsMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected