MCPcopy
hub / github.com/jestjs/jest / runTest

Function runTest

packages/jest-runner/src/runTest.ts:401–429  ·  view source on GitHub ↗
(
  path: string,
  globalConfig: Config.GlobalConfig,
  config: Config.ProjectConfig,
  resolver: Resolver,
  context: TestRunnerContext,
  sendMessageToJest?: TestFileEvent,
)

Source from the content-addressed store, hash-verified

399}
400
401export default async function runTest(
402 path: string,
403 globalConfig: Config.GlobalConfig,
404 config: Config.ProjectConfig,
405 resolver: Resolver,
406 context: TestRunnerContext,
407 sendMessageToJest?: TestFileEvent,
408): Promise<TestResult> {
409 const {leakDetector, result} = await runTestInternal(
410 path,
411 globalConfig,
412 config,
413 resolver,
414 context,
415 sendMessageToJest,
416 );
417
418 if (leakDetector) {
419 // We wanna allow a tiny but time to pass to allow last-minute cleanup
420 await new Promise(resolve => setTimeout(resolve, 100));
421
422 // Resolve leak detector, outside the "runTestInternal" closure.
423 result.leaks = await leakDetector.isLeaking();
424 } else {
425 result.leaks = false;
426 }
427
428 return result;
429}

Callers 2

workerFunction · 0.70
#createInBandTestRunMethod · 0.70

Calls 2

runTestInternalFunction · 0.85
isLeakingMethod · 0.80

Tested by

no test coverage detected