lighthouse 9.5.0-dev.20220607 → 9.6.2

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.
Files changed (262) hide show
  1. package/dist/report/bundle.esm.js +467 -520
  2. package/dist/report/flow.js +22 -22
  3. package/dist/report/standalone.js +19 -19
  4. package/flow-report/src/summary/category.tsx +1 -1
  5. package/flow-report/src/topbar.tsx +2 -10
  6. package/flow-report/src/util.ts +1 -1
  7. package/flow-report/test/topbar-test.tsx +8 -7
  8. package/jest.config.js +1 -1
  9. package/lighthouse-cli/.eslintrc.cjs +4 -3
  10. package/lighthouse-cli/bin.js +1 -0
  11. package/lighthouse-cli/cli-flags.js +4 -3
  12. package/lighthouse-cli/commands/commands.js +1 -0
  13. package/lighthouse-cli/commands/list-audits.js +1 -0
  14. package/lighthouse-cli/commands/list-locales.js +1 -0
  15. package/lighthouse-cli/commands/list-trace-categories.js +1 -0
  16. package/lighthouse-cli/index.js +1 -0
  17. package/lighthouse-cli/printer.js +1 -0
  18. package/lighthouse-cli/run.js +24 -9
  19. package/lighthouse-cli/sentry-prompt.js +1 -0
  20. package/lighthouse-cli/test/smokehouse/core-tests.js +1 -0
  21. package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -0
  22. package/lighthouse-cli/test/smokehouse/frontends/lib.js +1 -0
  23. package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -0
  24. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -0
  25. package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -0
  26. package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -0
  27. package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -0
  28. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +23 -109
  29. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +3 -2
  30. package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +19 -28
  31. package/lighthouse-cli/test/smokehouse/report-assert.js +4 -3
  32. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  33. package/lighthouse-cli/test/smokehouse/version-check-test.js +3 -0
  34. package/lighthouse-cli/test/smokehouse/version-check.js +1 -0
  35. package/lighthouse-core/audits/accessibility/accesskeys.js +1 -1
  36. package/lighthouse-core/audits/accessibility/aria-allowed-attr.js +1 -1
  37. package/lighthouse-core/audits/accessibility/aria-command-name.js +1 -1
  38. package/lighthouse-core/audits/accessibility/aria-hidden-body.js +1 -1
  39. package/lighthouse-core/audits/accessibility/aria-hidden-focus.js +1 -1
  40. package/lighthouse-core/audits/accessibility/aria-input-field-name.js +1 -1
  41. package/lighthouse-core/audits/accessibility/aria-meter-name.js +1 -1
  42. package/lighthouse-core/audits/accessibility/aria-progressbar-name.js +1 -1
  43. package/lighthouse-core/audits/accessibility/aria-required-attr.js +1 -1
  44. package/lighthouse-core/audits/accessibility/aria-required-children.js +1 -1
  45. package/lighthouse-core/audits/accessibility/aria-required-parent.js +1 -1
  46. package/lighthouse-core/audits/accessibility/aria-roles.js +1 -1
  47. package/lighthouse-core/audits/accessibility/aria-toggle-field-name.js +1 -1
  48. package/lighthouse-core/audits/accessibility/aria-tooltip-name.js +1 -1
  49. package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
  50. package/lighthouse-core/audits/accessibility/aria-valid-attr-value.js +1 -1
  51. package/lighthouse-core/audits/accessibility/aria-valid-attr.js +1 -1
  52. package/lighthouse-core/audits/accessibility/button-name.js +1 -1
  53. package/lighthouse-core/audits/accessibility/bypass.js +1 -1
  54. package/lighthouse-core/audits/accessibility/color-contrast.js +1 -1
  55. package/lighthouse-core/audits/accessibility/definition-list.js +1 -1
  56. package/lighthouse-core/audits/accessibility/dlitem.js +1 -1
  57. package/lighthouse-core/audits/accessibility/document-title.js +1 -1
  58. package/lighthouse-core/audits/accessibility/duplicate-id-active.js +1 -1
  59. package/lighthouse-core/audits/accessibility/duplicate-id-aria.js +1 -1
  60. package/lighthouse-core/audits/accessibility/form-field-multiple-labels.js +1 -1
  61. package/lighthouse-core/audits/accessibility/frame-title.js +1 -1
  62. package/lighthouse-core/audits/accessibility/heading-order.js +1 -1
  63. package/lighthouse-core/audits/accessibility/html-has-lang.js +1 -1
  64. package/lighthouse-core/audits/accessibility/html-lang-valid.js +1 -1
  65. package/lighthouse-core/audits/accessibility/image-alt.js +1 -1
  66. package/lighthouse-core/audits/accessibility/input-image-alt.js +1 -1
  67. package/lighthouse-core/audits/accessibility/label.js +1 -1
  68. package/lighthouse-core/audits/accessibility/link-name.js +1 -1
  69. package/lighthouse-core/audits/accessibility/list.js +1 -1
  70. package/lighthouse-core/audits/accessibility/listitem.js +5 -5
  71. package/lighthouse-core/audits/accessibility/meta-refresh.js +1 -1
  72. package/lighthouse-core/audits/accessibility/meta-viewport.js +1 -1
  73. package/lighthouse-core/audits/accessibility/object-alt.js +1 -1
  74. package/lighthouse-core/audits/accessibility/tabindex.js +1 -1
  75. package/lighthouse-core/audits/accessibility/td-headers-attr.js +1 -1
  76. package/lighthouse-core/audits/accessibility/th-has-data-cells.js +1 -1
  77. package/lighthouse-core/audits/accessibility/valid-lang.js +1 -1
  78. package/lighthouse-core/audits/accessibility/video-caption.js +1 -1
  79. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
  80. package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +12 -11
  81. package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
  82. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +24 -22
  83. package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +2 -3
  84. package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +3 -2
  85. package/lighthouse-core/audits/byte-efficiency/unminified-css.js +5 -3
  86. package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +11 -10
  87. package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -0
  88. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +8 -11
  89. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
  90. package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
  91. package/lighthouse-core/audits/deprecations.js +598 -8
  92. package/lighthouse-core/audits/diagnostics.js +3 -4
  93. package/lighthouse-core/audits/dobetterweb/doctype.js +9 -20
  94. package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +1 -1
  95. package/lighthouse-core/audits/dobetterweb/no-document-write.js +1 -1
  96. package/lighthouse-core/audits/dobetterweb/notification-on-start.js +1 -1
  97. package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -2
  98. package/lighthouse-core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
  99. package/lighthouse-core/audits/errors-in-console.js +2 -2
  100. package/lighthouse-core/audits/long-tasks.js +2 -3
  101. package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
  102. package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -3
  103. package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -3
  104. package/lighthouse-core/audits/metrics/interactive.js +2 -3
  105. package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -3
  106. package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -3
  107. package/lighthouse-core/audits/metrics/speed-index.js +2 -3
  108. package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -3
  109. package/lighthouse-core/audits/metrics.js +2 -3
  110. package/lighthouse-core/audits/no-unload-listeners.js +15 -7
  111. package/lighthouse-core/audits/predictive-perf.js +1 -2
  112. package/lighthouse-core/audits/preload-lcp-image.js +3 -3
  113. package/lighthouse-core/audits/redirects.js +1 -1
  114. package/lighthouse-core/audits/script-treemap-data.js +45 -45
  115. package/lighthouse-core/audits/seo/http-status-code.js +4 -2
  116. package/lighthouse-core/audits/seo/link-text.js +0 -2
  117. package/lighthouse-core/audits/server-response-time.js +17 -2
  118. package/lighthouse-core/audits/service-worker.js +2 -7
  119. package/lighthouse-core/audits/timing-budget.js +2 -3
  120. package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
  121. package/lighthouse-core/audits/uses-rel-preload.js +1 -1
  122. package/lighthouse-core/audits/valid-source-maps.js +14 -12
  123. package/lighthouse-core/audits/violation-audit.js +1 -1
  124. package/lighthouse-core/audits/work-during-interaction.js +2 -2
  125. package/lighthouse-core/computed/critical-request-chains.js +9 -5
  126. package/lighthouse-core/computed/js-bundles.js +11 -11
  127. package/lighthouse-core/computed/main-resource.js +2 -3
  128. package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
  129. package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
  130. package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
  131. package/lighthouse-core/computed/metrics/interactive.js +1 -1
  132. package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
  133. package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
  134. package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
  135. package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
  136. package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
  137. package/lighthouse-core/computed/metrics/lantern-metric.js +5 -3
  138. package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
  139. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
  140. package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
  141. package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
  142. package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
  143. package/lighthouse-core/computed/metrics/metric.js +0 -1
  144. package/lighthouse-core/computed/metrics/speed-index.js +1 -1
  145. package/lighthouse-core/computed/metrics/timing-summary.js +6 -13
  146. package/lighthouse-core/computed/metrics/total-blocking-time.js +1 -1
  147. package/lighthouse-core/computed/module-duplication.js +5 -6
  148. package/lighthouse-core/computed/page-dependency-graph.js +28 -55
  149. package/lighthouse-core/computed/resource-summary.js +5 -5
  150. package/lighthouse-core/computed/unused-css.js +7 -6
  151. package/lighthouse-core/computed/unused-javascript-summary.js +36 -16
  152. package/lighthouse-core/config/budget.js +2 -2
  153. package/lighthouse-core/config/default-config.js +1 -2
  154. package/lighthouse-core/fraggle-rock/api.js +1 -1
  155. package/lighthouse-core/fraggle-rock/config/default-config.js +0 -3
  156. package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +3 -6
  157. package/lighthouse-core/fraggle-rock/gather/driver.js +2 -2
  158. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +26 -51
  159. package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
  160. package/lighthouse-core/fraggle-rock/gather/session.js +22 -23
  161. package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
  162. package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +6 -6
  163. package/lighthouse-core/gather/connections/cri.js +1 -5
  164. package/lighthouse-core/gather/driver/execution-context.js +2 -5
  165. package/lighthouse-core/gather/driver/navigation.js +10 -13
  166. package/lighthouse-core/gather/driver/network-monitor.js +3 -16
  167. package/lighthouse-core/gather/driver.js +1 -6
  168. package/lighthouse-core/gather/fetcher.js +210 -34
  169. package/lighthouse-core/gather/gather-runner.js +17 -13
  170. package/lighthouse-core/gather/gatherers/accessibility.js +4 -16
  171. package/lighthouse-core/gather/gatherers/console-messages.js +2 -4
  172. package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +2 -4
  173. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +2 -3
  174. package/lighthouse-core/gather/gatherers/iframe-elements.js +1 -4
  175. package/lighthouse-core/gather/gatherers/image-elements.js +0 -2
  176. package/lighthouse-core/gather/gatherers/js-usage.js +87 -12
  177. package/lighthouse-core/gather/gatherers/link-elements.js +14 -12
  178. package/lighthouse-core/gather/gatherers/main-document-content.js +8 -8
  179. package/lighthouse-core/gather/gatherers/script-elements.js +56 -7
  180. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +30 -2
  181. package/lighthouse-core/gather/gatherers/source-maps.js +1 -8
  182. package/lighthouse-core/gather/gatherers/web-app-manifest.js +2 -2
  183. package/lighthouse-core/index.js +2 -26
  184. package/lighthouse-core/lib/cdt/generated/SourceMap.js +1 -1
  185. package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +29 -8
  186. package/lighthouse-core/lib/navigation-error.js +4 -13
  187. package/lighthouse-core/lib/page-functions.js +1 -3
  188. package/lighthouse-core/lib/script-helpers.js +6 -11
  189. package/lighthouse-core/lib/url-shim.js +2 -2
  190. package/lighthouse-core/runner.js +5 -0
  191. package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -0
  192. package/lighthouse-core/util-commonjs.js +6 -8
  193. package/package.json +13 -13
  194. package/readme.md +1 -1
  195. package/report/.eslintrc.cjs +1 -3
  196. package/report/assets/styles.css +5 -10
  197. package/report/assets/templates.html +9 -10
  198. package/report/clients/bundle.js +1 -0
  199. package/report/clients/standalone.js +1 -0
  200. package/report/generator/report-generator.js +21 -46
  201. package/report/renderer/api.js +2 -0
  202. package/report/renderer/category-renderer.js +24 -20
  203. package/report/renderer/components.js +304 -303
  204. package/report/renderer/crc-details-renderer.js +24 -21
  205. package/report/renderer/details-renderer.js +12 -12
  206. package/report/renderer/dom.js +7 -6
  207. package/report/renderer/drop-down-menu.js +1 -0
  208. package/report/renderer/element-screenshot-renderer.js +5 -1
  209. package/report/renderer/features-util.js +1 -0
  210. package/report/renderer/i18n.js +62 -118
  211. package/report/renderer/logger.js +1 -0
  212. package/report/renderer/open-tab.js +3 -1
  213. package/report/renderer/performance-category-renderer.js +11 -10
  214. package/report/renderer/pwa-category-renderer.js +4 -3
  215. package/report/renderer/report-renderer.js +17 -17
  216. package/report/renderer/report-ui-features.js +1 -0
  217. package/report/renderer/snippet-renderer.js +3 -2
  218. package/report/renderer/swap-locale-feature.js +1 -0
  219. package/report/renderer/text-encoding.js +1 -0
  220. package/report/renderer/topbar-features.js +1 -0
  221. package/report/renderer/util.js +6 -7
  222. package/report/test/clients/bundle-test.js +5 -0
  223. package/report/test/generator/file-namer-test.js +1 -0
  224. package/report/test/generator/report-generator-test.js +20 -25
  225. package/report/test/renderer/category-renderer-test.js +4 -3
  226. package/report/test/renderer/components-test.js +3 -0
  227. package/report/test/renderer/crc-details-renderer-test.js +3 -0
  228. package/report/test/renderer/details-renderer-test.js +3 -49
  229. package/report/test/renderer/dom-test.js +3 -0
  230. package/report/test/renderer/element-screenshot-renderer-test.js +6 -3
  231. package/report/test/renderer/i18n-test.js +25 -70
  232. package/report/test/renderer/performance-category-renderer-test.js +5 -14
  233. package/report/test/renderer/pwa-category-renderer-test.js +4 -3
  234. package/report/test/renderer/report-renderer-axe-test.js +4 -3
  235. package/report/test/renderer/report-renderer-test.js +4 -3
  236. package/report/test/renderer/report-ui-features-test.js +4 -3
  237. package/report/test/renderer/snippet-renderer-test.js +3 -0
  238. package/report/test/renderer/text-encoding-test.js +3 -0
  239. package/report/test/renderer/util-test.js +5 -4
  240. package/report/test-assets/faux-psi.js +1 -2
  241. package/shared/localization/format.js +3 -7
  242. package/shared/localization/locales/en-US.json +238 -55
  243. package/shared/localization/locales/en-XL.json +238 -55
  244. package/shared/test/localization/format-test.js +2 -8
  245. package/shared/test/localization/locales-test.js +2 -0
  246. package/shared/test/localization/swap-locale-test.js +2 -0
  247. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -0
  248. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  249. package/tsconfig.json +0 -1
  250. package/types/artifacts.d.ts +8 -47
  251. package/types/config.d.ts +0 -2
  252. package/types/externs.d.ts +2 -3
  253. package/types/gatherer.d.ts +2 -1
  254. package/types/global-lh.d.ts +0 -3
  255. package/types/lhr/lhr.d.ts +2 -2
  256. package/types/lhr/treemap.d.ts +1 -0
  257. package/changelog.md +0 -5902
  258. package/lighthouse-core/audits/script-elements-test-audit.js +0 -30
  259. package/lighthouse-core/gather/gatherers/scripts.js +0 -154
  260. package/lighthouse-core/scripts/package.json +0 -4
  261. package/report/test/.eslintrc.cjs +0 -11
  262. package/shared/test/localization/.eslintrc.cjs +0 -11
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ 'use strict';
17
18
 
18
19
  /** @typedef {import('./dom.js').DOM} DOM */
19
20
 
@@ -39,7 +40,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
39
40
  valueEl.textContent = audit.result.displayValue || '';
40
41
 
41
42
  const descriptionEl = this.dom.find('.lh-metric__description', tmpl);
42
- descriptionEl.append(this.dom.convertMarkdownLinkSnippets(audit.result.description));
43
+ descriptionEl.appendChild(this.dom.convertMarkdownLinkSnippets(audit.result.description));
43
44
 
44
45
  if (audit.result.scoreDisplayMode === 'error') {
45
46
  descriptionEl.textContent = '';
@@ -179,7 +180,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
179
180
  const strings = Util.i18n.strings;
180
181
  const element = this.dom.createElement('div', 'lh-category');
181
182
  element.id = category.id;
182
- element.append(this.renderCategoryHeader(category, groups, options));
183
+ element.appendChild(this.renderCategoryHeader(category, groups, options));
183
184
 
184
185
  // Metrics.
185
186
  const metricAudits = category.auditRefs.filter(audit => audit.group === 'metrics');
@@ -204,7 +205,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
204
205
  const metricsBoxesEl = this.dom.createElement('div', 'lh-metrics-container');
205
206
  metricsGroupEl.insertBefore(metricsBoxesEl, metricsFooterEl);
206
207
  metricAudits.forEach(item => {
207
- metricsBoxesEl.append(this._renderMetric(item));
208
+ metricsBoxesEl.appendChild(this._renderMetric(item));
208
209
  });
209
210
 
210
211
  // Only add the disclaimer with the score calculator link if the category was rendered with a score gauge.
@@ -212,7 +213,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
212
213
  const descriptionEl = this.dom.find('.lh-category-header__description', element);
213
214
  const estValuesEl = this.dom.createChildOf(descriptionEl, 'div', 'lh-metrics__disclaimer');
214
215
  const disclaimerEl = this.dom.convertMarkdownLinkSnippets(strings.varianceDisclaimer);
215
- estValuesEl.append(disclaimerEl);
216
+ estValuesEl.appendChild(disclaimerEl);
216
217
 
217
218
  // Add link to score calculator.
218
219
  const calculatorLink = this.dom.createChildOf(estValuesEl, 'a', 'lh-calclink');
@@ -222,7 +223,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
222
223
  }
223
224
 
224
225
  metricsGroupEl.classList.add('lh-audit-group--metrics');
225
- element.append(metricsGroupEl);
226
+ element.appendChild(metricsGroupEl);
226
227
  }
227
228
 
228
229
  // Filmstrip
@@ -232,7 +233,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
232
233
  if (thumbnailResult?.details) {
233
234
  timelineEl.id = thumbnailResult.id;
234
235
  const filmstripEl = this.detailsRenderer.render(thumbnailResult.details);
235
- filmstripEl && timelineEl.append(filmstripEl);
236
+ filmstripEl && timelineEl.appendChild(filmstripEl);
236
237
  }
237
238
 
238
239
  // Opportunities
@@ -266,7 +267,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
266
267
  opportunityAudits.forEach(item =>
267
268
  groupEl.insertBefore(this._renderOpportunity(item, scale), footerEl));
268
269
  groupEl.classList.add('lh-audit-group--load-opportunities');
269
- element.append(groupEl);
270
+ element.appendChild(groupEl);
270
271
  }
271
272
 
272
273
  // Diagnostics
@@ -283,7 +284,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
283
284
  const [groupEl, footerEl] = this.renderAuditGroup(groups['diagnostics']);
284
285
  diagnosticAudits.forEach(item => groupEl.insertBefore(this.renderAudit(item), footerEl));
285
286
  groupEl.classList.add('lh-audit-group--diagnostics');
286
- element.append(groupEl);
287
+ element.appendChild(groupEl);
287
288
  }
288
289
 
289
290
  // Passed audits
@@ -297,7 +298,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
297
298
  groupDefinitions: groups,
298
299
  };
299
300
  const passedElem = this.renderClump('passed', clumpOpts);
300
- element.append(passedElem);
301
+ element.appendChild(passedElem);
301
302
 
302
303
  // Budgets
303
304
  /** @type {Array<Element>} */
@@ -317,7 +318,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
317
318
  const [groupEl, footerEl] = this.renderAuditGroup(groups.budgets);
318
319
  budgetTableEls.forEach(table => groupEl.insertBefore(table, footerEl));
319
320
  groupEl.classList.add('lh-audit-group--budgets');
320
- element.append(groupEl);
321
+ element.appendChild(groupEl);
321
322
  }
322
323
 
323
324
  return element;
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ 'use strict';
17
18
 
18
19
  import {Util} from './util.js';
19
20
  import {CategoryRenderer} from './category-renderer.js';
@@ -27,7 +28,7 @@ export class PwaCategoryRenderer extends CategoryRenderer {
27
28
  render(category, groupDefinitions = {}) {
28
29
  const categoryElem = this.dom.createElement('div', 'lh-category');
29
30
  categoryElem.id = category.id;
30
- categoryElem.append(this.renderCategoryHeader(category, groupDefinitions));
31
+ categoryElem.appendChild(this.renderCategoryHeader(category, groupDefinitions));
31
32
 
32
33
  const auditRefs = category.auditRefs;
33
34
 
@@ -35,13 +36,13 @@ export class PwaCategoryRenderer extends CategoryRenderer {
35
36
  // all put in a top-level clump that isn't expandable/collapsible.
36
37
  const regularAuditRefs = auditRefs.filter(ref => ref.result.scoreDisplayMode !== 'manual');
37
38
  const auditsElem = this._renderAudits(regularAuditRefs, groupDefinitions);
38
- categoryElem.append(auditsElem);
39
+ categoryElem.appendChild(auditsElem);
39
40
 
40
41
  // Manual audits are still in a manual clump.
41
42
  const manualAuditRefs = auditRefs.filter(ref => ref.result.scoreDisplayMode === 'manual');
42
43
  const manualElem = this.renderClump('manual',
43
44
  {auditRefs: manualAuditRefs, description: category.manualDescription});
44
- categoryElem.append(manualElem);
45
+ categoryElem.appendChild(manualElem);
45
46
 
46
47
  return categoryElem;
47
48
  }
@@ -17,6 +17,7 @@
17
17
  * Dummy text for ensuring report robustness: </script> pre$`post %%LIGHTHOUSE_JSON%%
18
18
  * (this is handled by terser)
19
19
  */
20
+ 'use strict';
20
21
 
21
22
  /** @typedef {import('./dom.js').DOM} DOM */
22
23
 
@@ -70,7 +71,7 @@ export class ReportRenderer {
70
71
  const report = Util.prepareReportResult(lhr);
71
72
 
72
73
  this._dom.rootEl.textContent = ''; // Remove previous report.
73
- this._dom.rootEl.append(this._renderReport(report));
74
+ this._dom.rootEl.appendChild(this._renderReport(report));
74
75
 
75
76
  return this._dom.rootEl;
76
77
  }
@@ -178,13 +179,11 @@ export class ReportRenderer {
178
179
  const message = this._dom.find('.lh-warnings__msg', container);
179
180
  message.textContent = Util.i18n.strings.toplevelWarningsMessage;
180
181
 
181
- const warnings = [];
182
+ const warnings = this._dom.find('ul', container);
182
183
  for (const warningString of report.runWarnings) {
183
- const warning = this._dom.createElement('li');
184
- warning.append(this._dom.convertMarkdownLinkSnippets(warningString));
185
- warnings.push(warning);
184
+ const warning = warnings.appendChild(this._dom.createElement('li'));
185
+ warning.appendChild(this._dom.convertMarkdownLinkSnippets(warningString));
186
186
  }
187
- this._dom.find('ul', container).append(...warnings);
188
187
 
189
188
  return container;
190
189
  }
@@ -277,11 +276,11 @@ export class ReportRenderer {
277
276
  };
278
277
 
279
278
  const headerContainer = this._dom.createElement('div');
280
- headerContainer.append(this._renderReportHeader());
279
+ headerContainer.appendChild(this._renderReportHeader());
281
280
 
282
281
  const reportContainer = this._dom.createElement('div', 'lh-container');
283
282
  const reportSection = this._dom.createElement('div', 'lh-report');
284
- reportSection.append(this._renderReportWarnings(report));
283
+ reportSection.appendChild(this._renderReportWarnings(report));
285
284
 
286
285
  let scoreHeader;
287
286
  const isSoloCategory = Object.keys(report.categories).length === 1;
@@ -298,23 +297,23 @@ export class ReportRenderer {
298
297
  const scoresContainer = this._dom.find('.lh-scores-container', headerContainer);
299
298
  scoreHeader.append(
300
299
  ...this._renderScoreGauges(report, categoryRenderer, specificCategoryRenderers));
301
- scoresContainer.append(scoreHeader, scoreScale);
300
+ scoresContainer.appendChild(scoreHeader);
301
+ scoresContainer.appendChild(scoreScale);
302
302
 
303
303
  const stickyHeader = this._dom.createElement('div', 'lh-sticky-header');
304
304
  stickyHeader.append(
305
305
  ...this._renderScoreGauges(report, categoryRenderer, specificCategoryRenderers));
306
- reportContainer.append(stickyHeader);
306
+ reportContainer.appendChild(stickyHeader);
307
307
  }
308
308
 
309
- const categories = this._dom.createElement('div', 'lh-categories');
310
- reportSection.append(categories);
309
+ const categories = reportSection.appendChild(this._dom.createElement('div', 'lh-categories'));
311
310
  const categoryOptions = {gatherMode: report.gatherMode};
312
311
  for (const category of Object.values(report.categories)) {
313
312
  const renderer = specificCategoryRenderers[category.id] || categoryRenderer;
314
313
  // .lh-category-wrapper is full-width and provides horizontal rules between categories.
315
314
  // .lh-category within has the max-width: var(--report-content-max-width);
316
315
  const wrapper = renderer.dom.createChildOf(categories, 'div', 'lh-category-wrapper');
317
- wrapper.append(renderer.render(
316
+ wrapper.appendChild(renderer.render(
318
317
  category,
319
318
  report.categoryGroups,
320
319
  categoryOptions
@@ -329,12 +328,13 @@ export class ReportRenderer {
329
328
  }
330
329
 
331
330
  if (!this._opts.omitTopbar) {
332
- reportFragment.append(this._renderReportTopbar(report));
331
+ reportFragment.appendChild(this._renderReportTopbar(report));
333
332
  }
334
333
 
335
- reportFragment.append(reportContainer);
336
- reportSection.append(this._renderReportFooter(report));
337
- reportContainer.append(headerContainer, reportSection);
334
+ reportFragment.appendChild(reportContainer);
335
+ reportContainer.appendChild(headerContainer);
336
+ reportContainer.appendChild(reportSection);
337
+ reportSection.appendChild(this._renderReportFooter(report));
338
338
 
339
339
  if (fullPageScreenshot) {
340
340
  ElementScreenshotRenderer.installFullPageScreenshot(
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ 'use strict';
17
18
 
18
19
  /**
19
20
  * @fileoverview Adds tools button, print, and other dynamic functionality to
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  /** @typedef {import('./details-renderer').DetailsRenderer} DetailsRenderer */
8
9
  /** @typedef {import('./dom').DOM} DOM */
@@ -128,7 +129,7 @@ export class SnippetRenderer {
128
129
  // access the full element detail. Just being able to see the outer HTML isn't very useful.
129
130
  if (details.node && dom.isDevTools()) {
130
131
  const nodeContainer = dom.find('.lh-snippet__node', header);
131
- nodeContainer.append(detailsRenderer.renderNode(details.node));
132
+ nodeContainer.appendChild(detailsRenderer.renderNode(details.node));
132
133
  }
133
134
 
134
135
  return header;
@@ -163,7 +164,7 @@ export class SnippetRenderer {
163
164
  const lineContent = content + (truncated ? '…' : '');
164
165
  const lineContentEl = dom.find('.lh-snippet__line code', contentLine);
165
166
  if (contentType === LineContentType.MESSAGE) {
166
- lineContentEl.append(dom.convertMarkdownLinkSnippets(lineContent));
167
+ lineContentEl.appendChild(dom.convertMarkdownLinkSnippets(lineContent));
167
168
  } else {
168
169
  lineContentEl.textContent = lineContent;
169
170
  }
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  /**
8
9
  * @fileoverview Creates a <select> element, filled with all supported locales
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  /* global CompressionStream */
8
9
 
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  /* eslint-env browser */
8
9
 
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ 'use strict';
17
18
 
18
19
  /** @template T @typedef {import('./i18n').I18n<T>} I18n */
19
20
 
@@ -429,11 +430,10 @@ class Util {
429
430
  break;
430
431
  case 'devtools': {
431
432
  const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
432
- // eslint-disable-next-line max-len
433
433
  cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (DevTools)`;
434
- networkThrottling = `${Util.i18n.formatMilliseconds(requestLatencyMs)} HTTP RTT, ` +
435
- `${Util.i18n.formatKbps(throttling.downloadThroughputKbps)} down, ` +
436
- `${Util.i18n.formatKbps(throttling.uploadThroughputKbps)} up (DevTools)`;
434
+ networkThrottling = `${Util.i18n.formatNumber(requestLatencyMs)}${NBSP}ms HTTP RTT, ` +
435
+ `${Util.i18n.formatNumber(throttling.downloadThroughputKbps)}${NBSP}Kbps down, ` +
436
+ `${Util.i18n.formatNumber(throttling.uploadThroughputKbps)}${NBSP}Kbps up (DevTools)`;
437
437
 
438
438
  const isSlow4G = () => {
439
439
  return requestLatencyMs === 150 * 3.75 &&
@@ -445,10 +445,9 @@ class Util {
445
445
  }
446
446
  case 'simulate': {
447
447
  const {cpuSlowdownMultiplier, rttMs, throughputKbps} = throttling;
448
- // eslint-disable-next-line max-len
449
448
  cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (Simulated)`;
450
- networkThrottling = `${Util.i18n.formatMilliseconds(rttMs)} TCP RTT, ` +
451
- `${Util.i18n.formatKbps(throughputKbps)} throughput (Simulated)`;
449
+ networkThrottling = `${Util.i18n.formatNumber(rttMs)}${NBSP}ms TCP RTT, ` +
450
+ `${Util.i18n.formatNumber(throughputKbps)}${NBSP}Kbps throughput (Simulated)`;
452
451
 
453
452
  const isSlow4G = () => {
454
453
  return rttMs === 150 && throughputKbps === 1.6 * 1024;
@@ -4,6 +4,8 @@
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
 
7
+ 'use strict';
8
+
7
9
  import fs from 'fs';
8
10
 
9
11
  import jsdom from 'jsdom';
@@ -15,6 +17,9 @@ import {LH_ROOT} from '../../../root.js';
15
17
  const sampleResultsStr =
16
18
  fs.readFileSync(LH_ROOT + '/lighthouse-core/test/results/sample_v2.json', 'utf-8');
17
19
 
20
+
21
+ /* eslint-env jest */
22
+
18
23
  describe('lighthouseRenderer bundle', () => {
19
24
  let document;
20
25
  beforeAll(() => {
@@ -9,6 +9,7 @@ const assert = require('assert').strict;
9
9
 
10
10
  const getLhrFilenamePrefix = require('../../generator/file-namer.js').getLhrFilenamePrefix;
11
11
 
12
+ /* eslint-env jest */
12
13
  describe('file-namer helper', () => {
13
14
  it('generates filename prefixes', () => {
14
15
  const results = {
@@ -5,8 +5,6 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- /* eslint-disable no-irregular-whitespace */
9
-
10
8
  const assert = require('assert').strict;
11
9
  const fs = require('fs');
12
10
 
@@ -15,6 +13,8 @@ const csvValidator = require('csv-validator');
15
13
  const ReportGenerator = require('../../generator/report-generator.js');
16
14
  const sampleResults = require('../../../lighthouse-core/test/results/sample_v2.json');
17
15
 
16
+ /* eslint-env jest */
17
+
18
18
  describe('ReportGenerator', () => {
19
19
  describe('#replaceStrings', () => {
20
20
  it('should replace all occurrences', () => {
@@ -81,33 +81,28 @@ describe('ReportGenerator', () => {
81
81
 
82
82
  it('creates CSV for results', async () => {
83
83
  const path = './.results-as-csv.csv';
84
+ const headers = {
85
+ category: '',
86
+ name: '',
87
+ title: '',
88
+ type: '',
89
+ score: 42,
90
+ };
84
91
 
85
92
  const csvOutput = ReportGenerator.generateReport(sampleResults, 'csv');
86
93
  fs.writeFileSync(path, csvOutput);
87
94
 
88
95
  const lines = csvOutput.split('\n');
89
96
  expect(lines.length).toBeGreaterThan(100);
90
- expect(lines.slice(0, 15).join('\n')).toMatchInlineSnapshot(`
91
- "\\"requestedUrl\\",\\"finalUrl\\",\\"fetchTime\\",\\"gatherMode\\"
92
- \\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"2021-09-07T20:11:11.853Z\\",\\"navigation\\"
93
-
94
- category,score
95
- \\"performance\\",\\"0.26\\"
96
- \\"accessibility\\",\\"0.78\\"
97
- \\"best-practices\\",\\"0.25\\"
98
- \\"seo\\",\\"0.67\\"
99
- \\"pwa\\",\\"0.3\\"
100
-
101
- category,audit,score,displayValue,description
102
- \\"performance\\",\\"first-contentful-paint\\",\\"0.01\\",\\"6.8 s\\",\\"First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://web.dev/first-contentful-paint/).\\"
103
- \\"performance\\",\\"interactive\\",\\"0.41\\",\\"8.2 s\\",\\"Time to interactive is the amount of time it takes for the page to become fully interactive. [Learn more](https://web.dev/interactive/).\\"
104
- \\"performance\\",\\"speed-index\\",\\"0.21\\",\\"8.1 s\\",\\"Speed Index shows how quickly the contents of a page are visibly populated. [Learn more](https://web.dev/speed-index/).\\"
105
- \\"performance\\",\\"total-blocking-time\\",\\"0.2\\",\\"1,220 ms\\",\\"Sum of all time periods between FCP and Time to Interactive, when task length exceeded 50ms, expressed in milliseconds. [Learn more](https://web.dev/lighthouse-total-blocking-time/).\\"
97
+ expect(lines.slice(0, 3).join('\n')).toMatchInlineSnapshot(`
98
+ "requestedUrl,finalUrl,category,name,title,type,score
99
+ \\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"Performance\\",\\"performance-score\\",\\"Overall Performance Category Score\\",\\"numeric\\",\\"0.26\\"
100
+ \\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"http://localhost:10200/dobetterweb/dbw_tester.html\\",\\"Performance\\",\\"first-contentful-paint\\",\\"First Contentful Paint\\",\\"numeric\\",\\"0.01\\"
106
101
  "
107
102
  `);
108
103
 
109
104
  try {
110
- await csvValidator(path);
105
+ await csvValidator(path, headers);
111
106
  } catch (err) {
112
107
  assert.fail('CSV parser error:\n' + err.join('\n'));
113
108
  } finally {
@@ -115,13 +110,13 @@ category,audit,score,displayValue,description
115
110
  }
116
111
  });
117
112
 
118
- it('creates CSV for results including categories', () => {
113
+ it('creates CSV for results including overall category scores', () => {
119
114
  const csvOutput = ReportGenerator.generateReport(sampleResults, 'csv');
120
- expect(csvOutput).toContain('performance');
121
- expect(csvOutput).toContain('accessibility');
122
- expect(csvOutput).toContain('best-practices');
123
- expect(csvOutput).toContain('seo');
124
- expect(csvOutput).toContain('pwa');
115
+ expect(csvOutput).toContain('performance-score');
116
+ expect(csvOutput).toContain('accessibility-score');
117
+ expect(csvOutput).toContain('best-practices-score');
118
+ expect(csvOutput).toContain('seo-score');
119
+ expect(csvOutput).toContain('pwa-score');
125
120
  });
126
121
 
127
122
  it('writes extended info', () => {
@@ -3,6 +3,9 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
7
+
8
+ /* eslint-env jest */
6
9
 
7
10
  import {strict as assert} from 'assert';
8
11
 
@@ -13,9 +16,7 @@ import {I18n} from '../../renderer/i18n.js';
13
16
  import {DOM} from '../../renderer/dom.js';
14
17
  import {DetailsRenderer} from '../../renderer/details-renderer.js';
15
18
  import {CategoryRenderer} from '../../renderer/category-renderer.js';
16
- import {readJson} from '../../../root.js';
17
-
18
- const sampleResultsOrig = readJson('../../../lighthouse-core/test/results/sample_v2.json', import.meta);
19
+ import sampleResultsOrig from '../../../lighthouse-core/test/results/sample_v2.json';
19
20
 
20
21
  describe('CategoryRenderer', () => {
21
22
  let renderer;
@@ -3,6 +3,9 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
7
+
8
+ /* eslint-env jest */
6
9
 
7
10
  import fs from 'fs';
8
11
 
@@ -3,6 +3,9 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
7
+
8
+ /* eslint-env jest */
6
9
 
7
10
  import {strict as assert} from 'assert';
8
11
 
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  import {strict as assert} from 'assert';
8
9
 
@@ -13,6 +14,8 @@ import {Util} from '../../renderer/util.js';
13
14
  import {I18n} from '../../renderer/i18n.js';
14
15
  import {DetailsRenderer} from '../../renderer/details-renderer.js';
15
16
 
17
+ /* eslint-env jest */
18
+
16
19
  describe('DetailsRenderer', () => {
17
20
  let renderer;
18
21
 
@@ -84,55 +87,6 @@ describe('DetailsRenderer', () => {
84
87
  '--thumbnail not set');
85
88
  });
86
89
 
87
- it('renders with default granularity', () => {
88
- const el = renderer.render({
89
- type: 'table',
90
- headings: [
91
- {text: '', key: 'bytes', itemType: 'bytes'},
92
- {text: '', key: 'numeric', itemType: 'numeric'},
93
- {text: '', key: 'ms', itemType: 'ms'},
94
- // Verify that 0 is ignored.
95
- {text: '', key: 'ms', itemType: 'ms', granularity: 0},
96
- ],
97
- items: [
98
- {
99
- bytes: 1234.567,
100
- numeric: 1234.567,
101
- ms: 1234.567,
102
- },
103
- ],
104
- });
105
-
106
- assert.equal(el.querySelectorAll('td').length, 4, 'did not render table cells');
107
- assert.equal(el.querySelectorAll('td')[0].textContent, '1.2\xa0KiB');
108
- assert.equal(el.querySelectorAll('td')[1].textContent, '1,234.6');
109
- assert.equal(el.querySelectorAll('td')[2].textContent, '1,230\xa0ms');
110
- assert.equal(el.querySelectorAll('td')[3].textContent, '1,230\xa0ms');
111
- });
112
-
113
- it('renders with custom granularity', () => {
114
- const el = renderer.render({
115
- type: 'table',
116
- headings: [
117
- {text: '', key: 'bytes', itemType: 'bytes', granularity: 0.01},
118
- {text: '', key: 'numeric', itemType: 'numeric', granularity: 100},
119
- {text: '', key: 'ms', itemType: 'ms', granularity: 1},
120
- ],
121
- items: [
122
- {
123
- bytes: 1234.567,
124
- numeric: 1234.567,
125
- ms: 1234.567,
126
- },
127
- ],
128
- });
129
-
130
- assert.equal(el.querySelectorAll('td').length, 3, 'did not render table cells');
131
- assert.equal(el.querySelectorAll('td')[0].textContent, '1.21\xa0KiB');
132
- assert.equal(el.querySelectorAll('td')[1].textContent, '1,200');
133
- assert.equal(el.querySelectorAll('td')[2].textContent, '1,235\xa0ms');
134
- });
135
-
136
90
  it('renders critical request chains', () => {
137
91
  const details = {
138
92
  type: 'criticalrequestchain',
@@ -3,6 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
6
7
 
7
8
  import {strict as assert} from 'assert';
8
9
 
@@ -13,6 +14,8 @@ import {DOM} from '../../renderer/dom.js';
13
14
  import {Util} from '../../renderer/util.js';
14
15
  import {I18n} from '../../renderer/i18n.js';
15
16
 
17
+ /* eslint-env jest */
18
+
16
19
  describe('DOM', () => {
17
20
  /** @type {DOM} */
18
21
  let dom;
@@ -3,6 +3,9 @@
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
+ 'use strict';
7
+
8
+ /* eslint-env jest */
6
9
 
7
10
  import jsdom from 'jsdom';
8
11
 
@@ -63,8 +66,7 @@ describe('ElementScreenshotRenderer', () => {
63
66
  /* eslint-disable max-len */
64
67
  expect(htmlFormatted).toMatchInlineSnapshot(`
65
68
  "
66
- <div class=\\"lh-element-screenshot__content\\">
67
- <div class=\\"lh-element-screenshot__image\\" style=\\"width: 500px; height: 500px; background-position-y: 0px; background-position-x: 0px; background-size: 1000px 1000px;\\">
69
+ <div class=\\"lh-element-screenshot__content\\" style=\\"top: -500px;\\">
68
70
  <div class=\\"lh-element-screenshot__mask\\" style=\\"width: 500px; height: 500px; clip-path: url(#clip-0);\\">
69
71
  <svg height=\\"0\\" width=\\"0\\"> <defs>
70
72
  <clipPath clipPathUnits=\\"objectBoundingBox\\" id=\\"clip-0\\">
@@ -72,7 +74,8 @@ describe('ElementScreenshotRenderer', () => {
72
74
  <polygon points=\\"0,0.7 1,0.7 1,1 0,1\\"></polygon>
73
75
  <polygon points=\\"0,0.1 0.1,0.1 0.1,0.7 0,0.7\\"></polygon>
74
76
  <polygon points=\\"0.5,0.1 1,0.1 1,0.7 0.5,0.7\\"></polygon></clipPath> </defs> </svg> </div>
75
- <div class=\\"lh-element-screenshot__element-marker\\" style=\\"width: 200px; height: 300px; left: 50px; top: 50px;\\"></div> </div> </div> "
77
+ <div class=\\"lh-element-screenshot__image\\" style=\\"width: 500px; height: 500px; background-position-y: 0px; background-position-x: 0px; background-size: 1000px 1000px;\\"></div>
78
+ <div class=\\"lh-element-screenshot__element-marker\\" style=\\"width: 200px; height: 300px; left: 50px; top: 50px;\\"></div> </div> "
76
79
  `);
77
80
  /* eslint-enable max-len */
78
81
  });