MCPcopy Create free account
hub / github.com/SoCreate/angular-playground / main

Function main

projects/cli/src/check-errors/verify-sandboxes.ts:39–69  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

37/////////////////////////////////
38
39async function main(config: Config) {
40 const hostUrl = `http://localhost:${config.angularCliPort}`;
41 const timeoutAttempts = config.timeout;
42 browser = await puppeteer.launch({
43 headless: 'new',
44 handleSIGINT: false,
45 args: CHROME_ARGS,
46 });
47
48 await waitForNgServe(browser, hostUrl, timeoutAttempts);
49
50 const scenarios = getSandboxMetadata(config, hostUrl, config.randomScenario);
51 console.log(`Retrieved ${scenarios.length} scenarios.\n`);
52
53 reporter = new ErrorReporter(scenarios, config.reportPath, config.reportType);
54 const page = await setupPageAndErrorHandling(hostUrl);
55 for (let i = 0; i < scenarios.length; i++) {
56 console.log(`Checking [${i + 1}/${scenarios.length}]: ${scenarios[i].name}: ${scenarios[i].description}`);
57 await openScenario(scenarios[i], page);
58 }
59 await page.close();
60 await browser.close();
61
62 const hasErrors = reporter.errors.length > 0;
63 // always generate report if report type is a file, or if there are errors
64 if (hasErrors || config.reportType !== REPORT_TYPE.LOG) {
65 reporter.compileReport();
66 }
67 const exitCode = hasErrors ? 1 : 0;
68 process.exit(exitCode);
69}
70
71async function setupPageAndErrorHandling(hostUrl): Promise<Page> {
72 const page = await browser.newPage();

Callers 1

verifySandboxesFunction · 0.70

Calls 5

waitForNgServeFunction · 0.90
getSandboxMetadataFunction · 0.85
openScenarioFunction · 0.85
compileReportMethod · 0.80

Tested by

no test coverage detected