MCPcopy Create free account
hub / github.com/code-pushup/cli / analyzeUrl

Method analyzeUrl

packages/plugin-axe/src/lib/runner/run-axe.ts:47–73  ·  view source on GitHub ↗

Analyzes a URL for accessibility issues using Axe.

(args: AxeUrlArgs)

Source from the content-addressed store, hash-verified

45
46 /** Analyzes a URL for accessibility issues using Axe. */
47 async analyzeUrl(args: AxeUrlArgs): Promise<AxeUrlResult> {
48 const browser = await this.launchBrowser();
49 const { url, urlIndex, urlsCount } = args;
50 const prefix = ansis.gray(`[${urlIndex + 1}/${urlsCount}]`);
51
52 return await logger.task(`${prefix} Analyzing URL ${url}`, async () => {
53 const context = await browser.newContext({
54 ...(this.storageState && { storageState: this.storageState }),
55 });
56
57 try {
58 const page = await context.newPage();
59 try {
60 const axeResults = await analyzePage(page, args);
61 const auditOutputs = toAuditOutputs(axeResults, url);
62 return {
63 message: `${prefix} Analyzed URL ${url}`,
64 result: { url, axeResults, auditOutputs },
65 };
66 } finally {
67 await page.close();
68 }
69 } finally {
70 await context.close();
71 }
72 });
73 }
74
75 /** Runs setup script and captures authentication state for reuse. */
76 async captureAuthState(

Callers 1

runForUrlFunction · 0.80

Calls 5

launchBrowserMethod · 0.95
analyzePageFunction · 0.85
taskMethod · 0.80
toAuditOutputsFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected