MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / initializeTestRunner

Function initializeTestRunner

curriculum/src/test/test-challenges.js:511–538  ·  view source on GitHub ↗
({
  build,
  sources,
  type,
  hooks,
  loadEnzyme
})

Source from the content-addressed store, hash-verified

509}
510
511async function initializeTestRunner({
512 build,
513 sources,
514 type,
515 hooks,
516 loadEnzyme
517}) {
518 // Ensure FCCTestRunner is available before creating it
519 await page.waitForFunction(
520 'window.FCCTestRunner && window.FCCTestRunner.createTestRunner',
521 { timeout: 5000 }
522 );
523
524 try {
525 await _initializeTestRunner({ build, sources, type, hooks, loadEnzyme });
526 } catch (e) {
527 // It's not clear why, but sometimes the iframe load times out. It seems to
528 // be an issue with Puppeteer, so we give it one more try to reduce test
529 // flakiness.
530 if (e.message.includes('Timed out waiting for the test frame to load')) {
531 console.warn('Test frame load timed out. Retrying...');
532 page = await createAndVisitNewPage();
533 await _initializeTestRunner({ build, sources, type, hooks, loadEnzyme });
534 } else {
535 throw e;
536 }
537 }
538}

Callers 1

getContextEvaluatorFunction · 0.85

Calls 2

_initializeTestRunnerFunction · 0.85
createAndVisitNewPageFunction · 0.85

Tested by

no test coverage detected