lighthouse 9.5.0-dev.20220422 → 9.5.0-dev.20220425

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,7 +66,6 @@ class Deprecations extends Audit {
66
66
  deprecations = artifacts.InspectorIssues.deprecationIssue
67
67
  // TODO: translate these strings.
68
68
  // see https://github.com/GoogleChrome/lighthouse/issues/13895
69
- // @ts-expect-error: .type hasn't released to npm yet
70
69
  .filter(deprecation => !deprecation.type || deprecation.type === 'Untranslated')
71
70
  .map(deprecation => {
72
71
  const {scriptId, url, lineNumber, columnNumber} = deprecation.sourceCodeLocation;
@@ -24,7 +24,7 @@ const UIStrings = {
24
24
  /** Explanatory message stating that the systemId field is not empty. */
25
25
  explanationSystemId: 'Expected systemId to be an empty string',
26
26
  /** Explanatory message stating that the doctype is set, but is not "html" and is therefore invalid. */
27
- explanationBadDoctype: 'Doctype name must be the lowercase string `html`',
27
+ explanationBadDoctype: 'Doctype name must be the string `html`',
28
28
  };
29
29
 
30
30
  const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
@@ -56,7 +56,7 @@ class Doctype extends Audit {
56
56
  }
57
57
 
58
58
  // only set constants once we know there is a doctype
59
- const doctypeName = artifacts.Doctype.name.trim();
59
+ const doctypeName = artifacts.Doctype.name;
60
60
  const doctypePublicId = artifacts.Doctype.publicId;
61
61
  const doctypeSystemId = artifacts.Doctype.systemId;
62
62
 
@@ -74,9 +74,8 @@ class Doctype extends Audit {
74
74
  };
75
75
  }
76
76
 
77
- /* Note that the value for name is case sensitive,
78
- and must be the string `html`. For details see:
79
- https://html.spec.whatwg.org/multipage/parsing.html#the-initial-insertion-mode */
77
+ /* Note that the casing of this property is normalized to be lowercase.
78
+ see: https://html.spec.whatwg.org/#doctype-name-state */
80
79
  if (doctypeName === 'html') {
81
80
  return {
82
81
  score: 1,
@@ -12,9 +12,6 @@ const axeLibSource = require('../../lib/axe.js').source;
12
12
  const pageFunctions = require('../../lib/page-functions.js');
13
13
 
14
14
  /**
15
- * This is run in the page, not Lighthouse itself.
16
- * axe.run returns a promise which fulfills with a results object
17
- * containing any violations.
18
15
  * @return {Promise<LH.Artifacts.Accessibility>}
19
16
  */
20
17
  /* c8 ignore start */
@@ -38,8 +35,11 @@ async function runA11yChecks() {
38
35
  'wcag2aa',
39
36
  ],
40
37
  },
38
+ // resultTypes doesn't limit the output of the axeResults object. Instead, if it's defined,
39
+ // some expensive element identification is done only for the respective types. https://github.com/dequelabs/axe-core/blob/f62f0cf18f7b69b247b0b6362cf1ae71ffbf3a1b/lib/core/reporters/helpers/process-aggregate.js#L61-L97
41
40
  resultTypes: ['violations', 'inapplicable'],
42
41
  rules: {
42
+ // Consider http://go/prcpg for expert review of the aXe rules.
43
43
  'tabindex': {enabled: true},
44
44
  'accesskeys': {enabled: true},
45
45
  'heading-order': {enabled: true},
@@ -60,6 +60,12 @@ async function runA11yChecks() {
60
60
  // https://github.com/dequelabs/axe-core/issues/2958
61
61
  'nested-interactive': {enabled: false},
62
62
  'frame-focusable-content': {enabled: false},
63
+ 'aria-roledescription': {enabled: false},
64
+ 'scrollable-region-focusable': {enabled: false},
65
+ // TODO(paulirish): create audits and enable these 3.
66
+ 'input-button-name': {enabled: false},
67
+ 'role-img-alt': {enabled: false},
68
+ 'select-name': {enabled: false},
63
69
  },
64
70
  });
65
71
 
@@ -70,7 +76,8 @@ async function runA11yChecks() {
70
76
  return {
71
77
  violations: axeResults.violations.map(createAxeRuleResultArtifact),
72
78
  incomplete: axeResults.incomplete.map(createAxeRuleResultArtifact),
73
- notApplicable: axeResults.inapplicable.map(result => ({id: result.id})),
79
+ notApplicable: axeResults.inapplicable.map(result => ({id: result.id})), // FYI: inapplicable => notApplicable!
80
+ passes: axeResults.passes.map(result => ({id: result.id})),
74
81
  version: axeResults.testEngine.version,
75
82
  };
76
83
  }
@@ -150,6 +157,11 @@ class Accessibility extends FRGatherer {
150
157
  supportedModes: ['snapshot', 'navigation'],
151
158
  };
152
159
 
160
+ static pageFns = {
161
+ runA11yChecks,
162
+ createAxeRuleResultArtifact,
163
+ };
164
+
153
165
  /**
154
166
  * @param {LH.Gatherer.FRTransitionalContext} passContext
155
167
  * @return {Promise<LH.Artifacts.Accessibility>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "9.5.0-dev.20220422",
3
+ "version": "9.5.0-dev.20220425",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -139,7 +139,7 @@
139
139
  "cpy": "^8.1.2",
140
140
  "cross-env": "^7.0.2",
141
141
  "csv-validator": "^0.0.3",
142
- "devtools-protocol": "0.0.975298",
142
+ "devtools-protocol": "0.0.995287",
143
143
  "es-main": "^1.0.2",
144
144
  "eslint": "^8.4.1",
145
145
  "eslint-config-google": "^0.14.0",
@@ -210,8 +210,8 @@
210
210
  "yargs-parser": "^21.0.0"
211
211
  },
212
212
  "resolutions": {
213
- "puppeteer/**/devtools-protocol": "0.0.975298",
214
- "puppeteer-core/**/devtools-protocol": "0.0.975298"
213
+ "puppeteer/**/devtools-protocol": "0.0.995287",
214
+ "puppeteer-core/**/devtools-protocol": "0.0.995287"
215
215
  },
216
216
  "repository": "GoogleChrome/lighthouse",
217
217
  "keywords": [
@@ -328,7 +328,7 @@ Array [
328
328
  }
329
329
  });
330
330
 
331
- it('uses null if the metric is missing its value', () => {
331
+ it('uses null if the metric\'s value is undefined', () => {
332
332
  const categoryClone = JSON.parse(JSON.stringify(category));
333
333
  const lcp = categoryClone.auditRefs.find(audit => audit.id === 'largest-contentful-paint');
334
334
  lcp.result.numericValue = undefined;
@@ -336,6 +336,16 @@ Array [
336
336
  const href = renderer._getScoringCalculatorHref(categoryClone.auditRefs);
337
337
  expect(href).toContain('LCP=null');
338
338
  });
339
+
340
+ it('uses null if the metric\'s value is null (LR)', () => {
341
+ const categoryClone = JSON.parse(JSON.stringify(category));
342
+ const lcp = categoryClone.auditRefs.find(audit => audit.id === 'largest-contentful-paint');
343
+ // In LR, we think there might be some case where undefined becomes null, but we can't prove it.
344
+ lcp.result.numericValue = null;
345
+ lcp.result.score = null;
346
+ const href = renderer._getScoringCalculatorHref(categoryClone.auditRefs);
347
+ expect(href).toContain('LCP=null');
348
+ });
339
349
  });
340
350
 
341
351
  // This is done all in CSS, but tested here.
@@ -777,7 +777,7 @@
777
777
  "message": "Specifying a doctype prevents the browser from switching to quirks-mode. [Learn more](https://web.dev/doctype/)."
778
778
  },
779
779
  "lighthouse-core/audits/dobetterweb/doctype.js | explanationBadDoctype": {
780
- "message": "Doctype name must be the lowercase string `html`"
780
+ "message": "Doctype name must be the string `html`"
781
781
  },
782
782
  "lighthouse-core/audits/dobetterweb/doctype.js | explanationNoDoctype": {
783
783
  "message": "Document must contain a doctype"
@@ -777,7 +777,7 @@
777
777
  "message": "Ŝṕêćîf́ŷín̂ǵ â d́ôćt̂ýp̂é p̂ŕêv́êńt̂ś t̂h́ê b́r̂óŵśêŕ f̂ŕôḿ ŝẃît́ĉh́îńĝ t́ô q́ûír̂ḱŝ-ḿôd́ê. [Ĺêár̂ń m̂ór̂é](https://web.dev/doctype/)."
778
778
  },
779
779
  "lighthouse-core/audits/dobetterweb/doctype.js | explanationBadDoctype": {
780
- "message": "D̂óĉt́ŷṕê ńâḿê ḿûśt̂ b́ê t́ĥé l̂óŵéćâś śt̂ŕîńĝ `html`"
780
+ "message": "D̂óĉt́ŷṕê ńâḿê ḿûśt̂ b́ê t́ĥé ŝt́r̂ín̂ǵ `html`"
781
781
  },
782
782
  "lighthouse-core/audits/dobetterweb/doctype.js | explanationNoDoctype": {
783
783
  "message": "D̂óĉúm̂én̂t́ m̂úŝt́ ĉón̂t́âín̂ á d̂óĉt́ŷṕê"
@@ -238,6 +238,7 @@ declare module Artifacts {
238
238
  interface Accessibility {
239
239
  violations: Array<AxeRuleResult>;
240
240
  notApplicable: Array<Pick<AxeRuleResult, 'id'>>;
241
+ passes: Array<Pick<AxeRuleResult, 'id'>>;
241
242
  incomplete: Array<AxeRuleResult>;
242
243
  version: string;
243
244
  }