lighthouse 9.3.1-dev.20220207 → 9.3.1-dev.20220211

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.
@@ -53,23 +53,44 @@ describe('ReportRendererAxe', () => {
53
53
  // eslint-disable-next-line no-undef
54
54
  const axeResults = await page.evaluate(config => axe.run(config), config);
55
55
 
56
- expect(axeResults.violations).toMatchObject([
57
- // Color contrast failure only pops up if this pptr is run headfully.
58
- // There are currently 27 problematic nodes, primarily audit display text and explanations.
59
- // TODO: fix these failures, regardless.
60
- // {
61
- // id: 'color-contrast',
62
- // },
63
- {
64
- id: 'duplicate-id',
65
- nodes: [
66
- // We use these audits in multiple categories. Makes sense.
67
- {html: '<div class="lh-audit lh-audit--binary lh-audit--pass" id="viewport">'},
68
- {html: '<div class="lh-audit lh-audit--binary lh-audit--fail" id="image-alt">'},
69
- {html: '<div class="lh-audit lh-audit--binary lh-audit--pass" id="document-title">'},
70
- ],
71
- },
72
- ]);
56
+ // Color contrast failure only pops up if this pptr is run headfully.
57
+ // There are currently 27 problematic nodes, primarily audit display text and explanations.
58
+ // TODO: fix these failures, regardless.
59
+ // {
60
+ // id: 'color-contrast',
61
+ // },
62
+
63
+ expect(axeResults.violations.find(v => v.id === 'duplicate-id')).toMatchObject({
64
+ id: 'duplicate-id',
65
+ nodes: [
66
+ // We use these audits in multiple categories. Makes sense.
67
+ {html: '<div class="lh-audit lh-audit--binary lh-audit--pass" id="viewport">'},
68
+ {html: '<div class="lh-audit lh-audit--binary lh-audit--fail" id="image-alt">'},
69
+ {html: '<div class="lh-audit lh-audit--binary lh-audit--pass" id="document-title">'},
70
+ ],
71
+ });
72
+
73
+ const axeSummary = axeResults.violations.map((v) => {
74
+ return {
75
+ id: v.id,
76
+ message: v.nodes.map((n) => n.failureSummary).join('\n'),
77
+ };
78
+ });
79
+ expect(axeSummary).toMatchInlineSnapshot(`
80
+ Array [
81
+ Object {
82
+ "id": "duplicate-id",
83
+ "message": "Fix any of the following:
84
+ Document has multiple static elements with the same id attribute: viewport
85
+ Fix any of the following:
86
+ Document has multiple static elements with the same id attribute: image-alt
87
+ Fix any of the following:
88
+ Document has multiple static elements with the same id attribute: document-title",
89
+ },
90
+ ]
91
+ `);
92
+
93
+ expect(axeResults.violations).toMatchSnapshot();
73
94
  },
74
95
  // This test takes 10s on fast hardware, but can take longer in CI.
75
96
  // https://github.com/dequelabs/axe-core/tree/b573b1c1/doc/examples/jest_react#timeout-issues
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import { Result as AuditResult } from "../../types/lhr/audit-result";
8
+ import { ReportUIFeatures } from "../renderer/report-ui-features.js";
8
9
 
9
10
  declare module Renderer {
10
11
  function renderReport(lhr: AuditResult, options?: Options): HTMLElement;
@@ -26,6 +27,12 @@ declare module Renderer {
26
27
  onPageAnchorRendered?: (link: HTMLAnchorElement) => void;
27
28
  /** If defined, `Save as HTML` option is shown in dropdown menu. */
28
29
  getStandaloneReportHTML?: () => string;
30
+ /**
31
+ * If defined, adds a `View Trace` button to the report, and calls this callback when clicked.
32
+ * The callback should do something to present the user with a visualization of the trace
33
+ * data, which can be gotten from the artifacts.
34
+ */
35
+ onViewTrace?: () => void;
29
36
  }
30
37
  }
31
38
 
@@ -2543,6 +2543,12 @@
2543
2543
  "report/renderer/util.js | varianceDisclaimer": {
2544
2544
  "message": "Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics."
2545
2545
  },
2546
+ "report/renderer/util.js | viewOriginalTraceLabel": {
2547
+ "message": "View Original Trace"
2548
+ },
2549
+ "report/renderer/util.js | viewTraceLabel": {
2550
+ "message": "View Trace"
2551
+ },
2546
2552
  "report/renderer/util.js | viewTreemapLabel": {
2547
2553
  "message": "View Treemap"
2548
2554
  },
@@ -2543,6 +2543,12 @@
2543
2543
  "report/renderer/util.js | varianceDisclaimer": {
2544
2544
  "message": "V̂ál̂úêś âŕê éŝt́îḿât́êd́ âńd̂ ḿâý v̂ár̂ý. T̂h́ê [ṕêŕf̂ór̂ḿâńĉé ŝćôŕê íŝ ćâĺĉúl̂át̂éd̂](https://web.dev/performance-scoring/) d́îŕêćt̂ĺŷ f́r̂óm̂ t́ĥéŝé m̂ét̂ŕîćŝ."
2545
2545
  },
2546
+ "report/renderer/util.js | viewOriginalTraceLabel": {
2547
+ "message": "V̂íêẃ Ôŕîǵîńâĺ T̂ŕâćê"
2548
+ },
2549
+ "report/renderer/util.js | viewTraceLabel": {
2550
+ "message": "V̂íêẃ T̂ŕâćê"
2551
+ },
2546
2552
  "report/renderer/util.js | viewTreemapLabel": {
2547
2553
  "message": "V̂íêẃ T̂ŕêém̂áp̂"
2548
2554
  },
@@ -26,6 +26,7 @@ import Treemap_ from './lhr/treemap';
26
26
  declare global {
27
27
  module LH {
28
28
  export type ArbitraryEqualityMap = ArbitraryEqualityMap_;
29
+ export type NavigationRequestor = string | (() => Promise<void> | void);
29
30
 
30
31
  // artifacts.d.ts
31
32
  export import Artifacts = Artifacts_.Artifacts;