Skip to content

Commit

Permalink
deps(axe-core): upgrade to 4.1.2 (#12075)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Feb 11, 2021
1 parent d10a464 commit f9f799c
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 298 deletions.
14 changes: 13 additions & 1 deletion lighthouse-core/gather/gatherers/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ async function runA11yChecks() {
/** @type {import('axe-core/axe')} */
// @ts-expect-error axe defined by axeLibSource
const axe = window.axe;
const application = `lighthouse-${Math.random()}`;
axe.configure({
branding: {
application,
},
// @ts-expect-error axe types don't yet include this new field
noHtml: true,
});
const axeResults = await axe.run(document, {
elementRef: true,
runOnly: {
Expand Down Expand Up @@ -59,11 +67,14 @@ async function runA11yChecks() {

/** @param {import('axe-core/axe').Result} result */
const augmentAxeNodes = result => {
result.helpUrl = result.helpUrl.replace(application, 'lighthouse');
if (axeResults.inapplicable.includes(result)) return;

result.nodes.forEach(node => {
// @ts-expect-error - getNodeDetails put into scope via stringification
node.node = getNodeDetails(node.element);
// @ts-expect-error - avoid circular JSON concerns
node.element = node.any = node.all = node.none = undefined;
node.element = node.any = node.all = node.none = node.html = undefined;
});

// Ensure errors can be serialized over the protocol
Expand All @@ -85,6 +96,7 @@ async function runA11yChecks() {
// Augment the node objects with outerHTML snippet & custom path string
axeResults.violations.forEach(augmentAxeNodes);
axeResults.incomplete.forEach(augmentAxeNodes);
axeResults.inapplicable.forEach(augmentAxeNodes);

// We only need violations, and circular references are possible outside of violations
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ describe('CategoryRenderer', () => {
const categoryClone = JSON.parse(JSON.stringify(category));

// Remove groups from some audits.
const ungroupedAudits = ['color-contrast', 'image-alt', 'link-name'];
const ungroupedAudits = ['image-alt', 'link-name'];
for (const auditRef of categoryClone.auditRefs) {
if (ungroupedAudits.includes(auditRef.id)) {
assert.ok(auditRef.group); // Make sure this will change something.
Expand Down
339 changes: 172 additions & 167 deletions lighthouse-core/test/results/artifacts/artifacts.json

Large diffs are not rendered by default.

189 changes: 66 additions & 123 deletions lighthouse-core/test/results/sample_v2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"webtreemap-cdt": "^3.0.1"
},
"dependencies": {
"axe-core": "4.1.1",
"axe-core": "4.1.2",
"chrome-launcher": "^0.13.4",
"configstore": "^5.0.1",
"cssstyle": "1.2.1",
Expand Down
1 change: 0 additions & 1 deletion types/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ declare global {
impact?: string;
tags: Array<string>;
nodes: Array<{
html: string;
target: Array<string>;
failureSummary?: string;
node: NodeDetails;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,10 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

axe-core@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.1.1.tgz#70a7855888e287f7add66002211a423937063eaf"
integrity sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==
axe-core@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.1.2.tgz#7cf783331320098bfbef620df3b3c770147bc224"
integrity sha512-V+Nq70NxKhYt89ArVcaNL9FDryB3vQOd+BFXZIfO3RP6rwtj+2yqqqdHEkacutglPaZLkJeuXKCjCJDMGPtPqg==

babel-code-frame@^6.22.0:
version "6.26.0"
Expand Down

0 comments on commit f9f799c

Please sign in to comment.