MCPcopy
hub / github.com/ampproject/amphtml / doTemplate

Function doTemplate

build-system/tasks/e2e/describes-e2e.js:459–505  ·  view source on GitHub ↗

* * @param {string} _name * @param {object} variant * @param {BrowserNameDef} browserName

(_name, variant, browserName)

Source from the content-addressed store, hash-verified

457 * @param {BrowserNameDef} browserName
458 */
459 function doTemplate(_name, variant, browserName) {
460 const env = Object.create(variant);
461 // @ts-ignore
462 this.timeout(TEST_TIMEOUT);
463 beforeEach(async function () {
464 this.timeout(SETUP_TIMEOUT);
465 configureHelpers(env);
466 await fixture.setup(env, browserName, SETUP_RETRIES);
467
468 // don't install for CI
469 if (!isCiBuild()) {
470 installRepl(global, env);
471 }
472 });
473
474 afterEach(async function () {
475 if (argv.coverage) {
476 await updateCoverage(env);
477 }
478
479 // If there is an async expect error, throw it in the final state.
480 const lastExpectError = getLastExpectError();
481 if (lastExpectError) {
482 /** @type {any} */ (this.test).error(lastExpectError);
483 clearLastExpectError();
484 }
485
486 await fixture.teardown(env);
487 for (const key in env) {
488 delete env[key];
489 }
490
491 if (!isCiBuild()) {
492 uninstallRepl();
493 }
494 });
495
496 after(async () => {
497 if (argv.coverage) {
498 await reportCoverage();
499 }
500 });
501
502 describe(SUB, function () {
503 fn.call(this, env);
504 });
505 }
506 };
507
508 /**

Callers

nothing calls this directly

Calls 14

beforeEachFunction · 0.85
configureHelpersFunction · 0.85
isCiBuildFunction · 0.85
installReplFunction · 0.85
afterEachFunction · 0.85
updateCoverageFunction · 0.85
getLastExpectErrorFunction · 0.85
clearLastExpectErrorFunction · 0.85
uninstallReplFunction · 0.85
reportCoverageFunction · 0.85
createMethod · 0.45
setupMethod · 0.45

Tested by

no test coverage detected