({
build,
sources,
type,
hooks,
loadEnzyme
})
| 509 | } |
| 510 | |
| 511 | async 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 | } |
no test coverage detected