lighthouse 9.5.0-dev.20220509 → 9.6.1

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 (259) hide show
  1. package/changelog.md +70 -0
  2. package/dist/report/bundle.esm.js +400 -808
  3. package/dist/report/flow.js +22 -27
  4. package/dist/report/standalone.js +18 -23
  5. package/flow-report/src/summary/category.tsx +1 -1
  6. package/jest.config.js +1 -1
  7. package/lighthouse-cli/.eslintrc.cjs +4 -3
  8. package/lighthouse-cli/bin.js +1 -0
  9. package/lighthouse-cli/cli-flags.js +4 -3
  10. package/lighthouse-cli/commands/commands.js +1 -0
  11. package/lighthouse-cli/commands/list-audits.js +1 -0
  12. package/lighthouse-cli/commands/list-locales.js +1 -0
  13. package/lighthouse-cli/commands/list-trace-categories.js +1 -0
  14. package/lighthouse-cli/index.js +1 -0
  15. package/lighthouse-cli/printer.js +1 -0
  16. package/lighthouse-cli/run.js +24 -9
  17. package/lighthouse-cli/sentry-prompt.js +1 -0
  18. package/lighthouse-cli/test/smokehouse/core-tests.js +1 -0
  19. package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -0
  20. package/lighthouse-cli/test/smokehouse/frontends/lib.js +1 -0
  21. package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -0
  22. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -0
  23. package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -0
  24. package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -0
  25. package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -0
  26. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +23 -109
  27. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +3 -2
  28. package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +19 -28
  29. package/lighthouse-cli/test/smokehouse/report-assert.js +4 -3
  30. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  31. package/lighthouse-cli/test/smokehouse/version-check-test.js +3 -0
  32. package/lighthouse-cli/test/smokehouse/version-check.js +1 -0
  33. package/lighthouse-core/audits/accessibility/accesskeys.js +1 -1
  34. package/lighthouse-core/audits/accessibility/aria-allowed-attr.js +1 -1
  35. package/lighthouse-core/audits/accessibility/aria-command-name.js +1 -1
  36. package/lighthouse-core/audits/accessibility/aria-hidden-body.js +1 -1
  37. package/lighthouse-core/audits/accessibility/aria-hidden-focus.js +1 -1
  38. package/lighthouse-core/audits/accessibility/aria-input-field-name.js +1 -1
  39. package/lighthouse-core/audits/accessibility/aria-meter-name.js +1 -1
  40. package/lighthouse-core/audits/accessibility/aria-progressbar-name.js +1 -1
  41. package/lighthouse-core/audits/accessibility/aria-required-attr.js +1 -1
  42. package/lighthouse-core/audits/accessibility/aria-required-children.js +1 -1
  43. package/lighthouse-core/audits/accessibility/aria-required-parent.js +1 -1
  44. package/lighthouse-core/audits/accessibility/aria-roles.js +1 -1
  45. package/lighthouse-core/audits/accessibility/aria-toggle-field-name.js +1 -1
  46. package/lighthouse-core/audits/accessibility/aria-tooltip-name.js +1 -1
  47. package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
  48. package/lighthouse-core/audits/accessibility/aria-valid-attr-value.js +1 -1
  49. package/lighthouse-core/audits/accessibility/aria-valid-attr.js +1 -1
  50. package/lighthouse-core/audits/accessibility/button-name.js +1 -1
  51. package/lighthouse-core/audits/accessibility/bypass.js +1 -1
  52. package/lighthouse-core/audits/accessibility/color-contrast.js +1 -1
  53. package/lighthouse-core/audits/accessibility/definition-list.js +1 -1
  54. package/lighthouse-core/audits/accessibility/dlitem.js +1 -1
  55. package/lighthouse-core/audits/accessibility/document-title.js +1 -1
  56. package/lighthouse-core/audits/accessibility/duplicate-id-active.js +1 -1
  57. package/lighthouse-core/audits/accessibility/duplicate-id-aria.js +1 -1
  58. package/lighthouse-core/audits/accessibility/form-field-multiple-labels.js +1 -1
  59. package/lighthouse-core/audits/accessibility/frame-title.js +1 -1
  60. package/lighthouse-core/audits/accessibility/heading-order.js +1 -1
  61. package/lighthouse-core/audits/accessibility/html-has-lang.js +1 -1
  62. package/lighthouse-core/audits/accessibility/html-lang-valid.js +1 -1
  63. package/lighthouse-core/audits/accessibility/image-alt.js +1 -1
  64. package/lighthouse-core/audits/accessibility/input-image-alt.js +1 -1
  65. package/lighthouse-core/audits/accessibility/label.js +1 -1
  66. package/lighthouse-core/audits/accessibility/link-name.js +1 -1
  67. package/lighthouse-core/audits/accessibility/list.js +1 -1
  68. package/lighthouse-core/audits/accessibility/listitem.js +5 -5
  69. package/lighthouse-core/audits/accessibility/meta-refresh.js +1 -1
  70. package/lighthouse-core/audits/accessibility/meta-viewport.js +1 -1
  71. package/lighthouse-core/audits/accessibility/object-alt.js +1 -1
  72. package/lighthouse-core/audits/accessibility/tabindex.js +1 -1
  73. package/lighthouse-core/audits/accessibility/td-headers-attr.js +1 -1
  74. package/lighthouse-core/audits/accessibility/th-has-data-cells.js +1 -1
  75. package/lighthouse-core/audits/accessibility/valid-lang.js +1 -1
  76. package/lighthouse-core/audits/accessibility/video-caption.js +1 -1
  77. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
  78. package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +12 -11
  79. package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
  80. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +24 -22
  81. package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +2 -3
  82. package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +3 -2
  83. package/lighthouse-core/audits/byte-efficiency/unminified-css.js +5 -3
  84. package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +11 -10
  85. package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -0
  86. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +8 -11
  87. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
  88. package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
  89. package/lighthouse-core/audits/deprecations.js +598 -8
  90. package/lighthouse-core/audits/diagnostics.js +3 -4
  91. package/lighthouse-core/audits/dobetterweb/doctype.js +9 -20
  92. package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +1 -1
  93. package/lighthouse-core/audits/dobetterweb/no-document-write.js +1 -1
  94. package/lighthouse-core/audits/dobetterweb/notification-on-start.js +1 -1
  95. package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -2
  96. package/lighthouse-core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
  97. package/lighthouse-core/audits/errors-in-console.js +2 -2
  98. package/lighthouse-core/audits/long-tasks.js +2 -3
  99. package/lighthouse-core/audits/metrics/experimental-interaction-to-next-paint.js +3 -1
  100. package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
  101. package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -3
  102. package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -3
  103. package/lighthouse-core/audits/metrics/interactive.js +2 -3
  104. package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -3
  105. package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -3
  106. package/lighthouse-core/audits/metrics/speed-index.js +2 -3
  107. package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -3
  108. package/lighthouse-core/audits/metrics.js +2 -3
  109. package/lighthouse-core/audits/no-unload-listeners.js +15 -7
  110. package/lighthouse-core/audits/predictive-perf.js +1 -2
  111. package/lighthouse-core/audits/preload-lcp-image.js +3 -3
  112. package/lighthouse-core/audits/redirects.js +1 -1
  113. package/lighthouse-core/audits/script-treemap-data.js +45 -45
  114. package/lighthouse-core/audits/seo/http-status-code.js +4 -2
  115. package/lighthouse-core/audits/seo/link-text.js +0 -2
  116. package/lighthouse-core/audits/server-response-time.js +17 -2
  117. package/lighthouse-core/audits/service-worker.js +2 -7
  118. package/lighthouse-core/audits/timing-budget.js +2 -3
  119. package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
  120. package/lighthouse-core/audits/uses-rel-preload.js +1 -1
  121. package/lighthouse-core/audits/valid-source-maps.js +14 -12
  122. package/lighthouse-core/audits/violation-audit.js +1 -1
  123. package/lighthouse-core/audits/work-during-interaction.js +280 -0
  124. package/lighthouse-core/computed/critical-request-chains.js +9 -5
  125. package/lighthouse-core/computed/js-bundles.js +11 -11
  126. package/lighthouse-core/computed/main-resource.js +2 -3
  127. package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
  128. package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
  129. package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
  130. package/lighthouse-core/computed/metrics/interactive.js +1 -1
  131. package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
  132. package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
  133. package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
  134. package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
  135. package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
  136. package/lighthouse-core/computed/metrics/lantern-metric.js +5 -3
  137. package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
  138. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
  139. package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
  140. package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
  141. package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
  142. package/lighthouse-core/computed/metrics/metric.js +0 -1
  143. package/lighthouse-core/computed/metrics/responsiveness.js +12 -9
  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/config/metrics-to-audits.js +5 -0
  155. package/lighthouse-core/fraggle-rock/api.js +1 -1
  156. package/lighthouse-core/fraggle-rock/config/default-config.js +8 -5
  157. package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +3 -6
  158. package/lighthouse-core/fraggle-rock/gather/driver.js +2 -2
  159. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +26 -51
  160. package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
  161. package/lighthouse-core/fraggle-rock/gather/session.js +2 -2
  162. package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
  163. package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +6 -6
  164. package/lighthouse-core/gather/connections/cri.js +0 -1
  165. package/lighthouse-core/gather/driver/execution-context.js +2 -4
  166. package/lighthouse-core/gather/driver/navigation.js +9 -9
  167. package/lighthouse-core/gather/driver/network-monitor.js +3 -16
  168. package/lighthouse-core/gather/driver.js +1 -6
  169. package/lighthouse-core/gather/fetcher.js +210 -34
  170. package/lighthouse-core/gather/gather-runner.js +17 -13
  171. package/lighthouse-core/gather/gatherers/accessibility.js +4 -16
  172. package/lighthouse-core/gather/gatherers/console-messages.js +2 -4
  173. package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +2 -4
  174. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +2 -3
  175. package/lighthouse-core/gather/gatherers/js-usage.js +87 -12
  176. package/lighthouse-core/gather/gatherers/link-elements.js +14 -12
  177. package/lighthouse-core/gather/gatherers/main-document-content.js +8 -8
  178. package/lighthouse-core/gather/gatherers/script-elements.js +56 -7
  179. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +30 -2
  180. package/lighthouse-core/gather/gatherers/source-maps.js +1 -3
  181. package/lighthouse-core/gather/gatherers/trace-elements.js +21 -2
  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/script-helpers.js +6 -11
  188. package/lighthouse-core/lib/url-shim.js +2 -2
  189. package/lighthouse-core/runner.js +5 -0
  190. package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -0
  191. package/lighthouse-core/util-commonjs.js +24 -28
  192. package/package.json +12 -12
  193. package/readme.md +1 -1
  194. package/report/.eslintrc.cjs +1 -3
  195. package/report/assets/styles.css +10 -12
  196. package/report/assets/templates.html +9 -10
  197. package/report/clients/bundle.js +1 -0
  198. package/report/clients/standalone.js +1 -0
  199. package/report/generator/report-generator.js +21 -46
  200. package/report/renderer/api.js +1 -0
  201. package/report/renderer/category-renderer.js +1 -0
  202. package/report/renderer/components.js +304 -303
  203. package/report/renderer/crc-details-renderer.js +1 -0
  204. package/report/renderer/details-renderer.js +10 -10
  205. package/report/renderer/dom.js +1 -0
  206. package/report/renderer/drop-down-menu.js +1 -0
  207. package/report/renderer/element-screenshot-renderer.js +4 -0
  208. package/report/renderer/features-util.js +1 -0
  209. package/report/renderer/i18n.js +62 -118
  210. package/report/renderer/logger.js +1 -0
  211. package/report/renderer/open-tab.js +3 -1
  212. package/report/renderer/performance-category-renderer.js +1 -0
  213. package/report/renderer/pwa-category-renderer.js +1 -0
  214. package/report/renderer/report-renderer.js +1 -0
  215. package/report/renderer/report-ui-features.js +1 -0
  216. package/report/renderer/snippet-renderer.js +1 -0
  217. package/report/renderer/swap-locale-feature.js +1 -0
  218. package/report/renderer/text-encoding.js +1 -0
  219. package/report/renderer/topbar-features.js +1 -0
  220. package/report/renderer/util.js +24 -27
  221. package/report/test/clients/bundle-test.js +4 -0
  222. package/report/test/generator/file-namer-test.js +1 -0
  223. package/report/test/generator/report-generator-test.js +20 -25
  224. package/report/test/renderer/category-renderer-test.js +3 -0
  225. package/report/test/renderer/components-test.js +3 -0
  226. package/report/test/renderer/crc-details-renderer-test.js +3 -0
  227. package/report/test/renderer/details-renderer-test.js +12 -58
  228. package/report/test/renderer/dom-test.js +3 -0
  229. package/report/test/renderer/element-screenshot-renderer-test.js +6 -3
  230. package/report/test/renderer/i18n-test.js +25 -70
  231. package/report/test/renderer/performance-category-renderer-test.js +4 -11
  232. package/report/test/renderer/pwa-category-renderer-test.js +3 -0
  233. package/report/test/renderer/report-renderer-axe-test.js +3 -0
  234. package/report/test/renderer/report-renderer-test.js +3 -0
  235. package/report/test/renderer/report-ui-features-test.js +3 -0
  236. package/report/test/renderer/snippet-renderer-test.js +3 -0
  237. package/report/test/renderer/text-encoding-test.js +3 -0
  238. package/report/test/renderer/util-test.js +5 -2
  239. package/report/test-assets/faux-psi.js +1 -2
  240. package/shared/localization/locales/en-US.json +260 -53
  241. package/shared/localization/locales/en-XL.json +260 -53
  242. package/shared/test/localization/format-test.js +2 -0
  243. package/shared/test/localization/locales-test.js +2 -0
  244. package/shared/test/localization/swap-locale-test.js +2 -0
  245. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -0
  246. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  247. package/tsconfig.json +0 -1
  248. package/types/artifacts.d.ts +9 -48
  249. package/types/config.d.ts +0 -2
  250. package/types/externs.d.ts +2 -2
  251. package/types/gatherer.d.ts +2 -1
  252. package/types/global-lh.d.ts +0 -3
  253. package/types/lhr/audit-details.d.ts +3 -1
  254. package/types/lhr/lhr.d.ts +2 -2
  255. package/types/lhr/treemap.d.ts +1 -0
  256. package/lighthouse-core/audits/script-elements-test-audit.js +0 -30
  257. package/lighthouse-core/gather/gatherers/scripts.js +0 -154
  258. package/report/test/.eslintrc.cjs +0 -11
  259. package/shared/test/localization/.eslintrc.cjs +0 -11
@@ -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
 
@@ -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',
@@ -188,24 +142,24 @@ describe('DetailsRenderer', () => {
188
142
  });
189
143
 
190
144
  it('renders lists', () => {
191
- const snippet = {
192
- type: 'snippet',
193
- lines: [{lineNumber: 1, content: ''}],
194
- title: 'Some snippet',
195
- lineMessages: [],
196
- generalMessages: [],
197
- lineCount: 100,
145
+ const table = {
146
+ type: 'table',
147
+ headings: [{text: '', key: 'numeric', itemType: 'numeric'}],
148
+ items: [{numeric: 1234.567}],
198
149
  };
199
150
 
200
151
  const el = renderer.render({
201
152
  type: 'list',
202
- items: [snippet, snippet],
153
+ items: [table, table],
203
154
  });
204
155
 
205
156
  assert.equal(el.localName, 'div');
206
157
  assert.ok(el.classList.contains('lh-list'), 'has list class');
207
158
  assert.ok(el.children.length, 2, 'renders all items');
208
- assert.ok(el.children[0].textContent.includes('Some snippet'), 'renders item content');
159
+ for (const child of el.children) {
160
+ assert.ok(child.classList.contains('lh-table'));
161
+ assert.equal(child.textContent, '1,234.6');
162
+ }
209
163
  });
210
164
 
211
165
  it('does not render internal-only screenshot details', () => {
@@ -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
  });
@@ -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
 
@@ -16,33 +17,14 @@ import '../../../lighthouse-core/lib/i18n/i18n.js';
16
17
 
17
18
  const NBSP = '\xa0';
18
19
 
20
+ /* eslint-env jest */
21
+
19
22
  describe('util helpers', () => {
20
23
  it('formats a number', () => {
21
24
  const i18n = new I18n('en', {...Util.UIStrings});
22
25
  assert.strictEqual(i18n.formatNumber(10), '10');
23
- assert.strictEqual(i18n.formatNumber(100.01), '100.01');
24
- assert.strictEqual(i18n.formatNumber(13000.456), '13,000.456');
25
- assert.strictEqual(i18n.formatNumber(13000.456444), '13,000.456');
26
-
27
- assert.strictEqual(i18n.formatNumber(10, 0.1), '10.0');
28
- assert.strictEqual(i18n.formatNumber(100.01, 0.1), '100.0');
29
- assert.strictEqual(i18n.formatNumber(13000.456, 0.1), '13,000.5');
30
-
31
- assert.strictEqual(i18n.formatNumber(0), '0');
32
- assert.strictEqual(i18n.formatNumber(-0), '0');
33
- assert.strictEqual(i18n.formatNumber(-0, 0.1), '0.0');
34
- assert.strictEqual(i18n.formatNumber(0.000001), '0');
35
- assert.strictEqual(i18n.formatNumber(-0.000001), '0');
36
- assert.strictEqual(i18n.formatNumber(0.000001, 0.1), '0.0');
37
- assert.strictEqual(i18n.formatNumber(-0.000001, 0.1), '0.0');
38
-
39
- assert.strictEqual(i18n.formatNumber(10), '10');
40
- assert.strictEqual(i18n.formatNumber(100.01), '100.01');
41
- assert.strictEqual(i18n.formatNumber(13000.456, 0.1), '13,000.5');
42
-
43
- assert.strictEqual(i18n.formatInteger(10), '10');
44
- assert.strictEqual(i18n.formatInteger(100.01), '100');
45
- assert.strictEqual(i18n.formatInteger(13000.6), '13,001');
26
+ assert.strictEqual(i18n.formatNumber(100.01), '100');
27
+ assert.strictEqual(i18n.formatNumber(13000.456), '13,000.5');
46
28
  });
47
29
 
48
30
  it('formats a date', () => {
@@ -57,10 +39,9 @@ describe('util helpers', () => {
57
39
 
58
40
  it('formats bytes', () => {
59
41
  const i18n = new I18n('en', {...Util.UIStrings});
60
- assert.equal(i18n.formatBytesToKiB(100), `0.098${NBSP}KiB`);
61
- assert.equal(i18n.formatBytesToKiB(100, 0.1), `0.1${NBSP}KiB`);
62
- assert.equal(i18n.formatBytesToKiB(2000, 0.1), `2.0${NBSP}KiB`);
63
- assert.equal(i18n.formatBytesToKiB(1014 * 1024, 0.1), `1,014.0${NBSP}KiB`);
42
+ assert.equal(i18n.formatBytesToKiB(100), `0.1${NBSP}KiB`);
43
+ assert.equal(i18n.formatBytesToKiB(2000), `2.0${NBSP}KiB`);
44
+ assert.equal(i18n.formatBytesToKiB(1014 * 1024), `1,014.0${NBSP}KiB`);
64
45
  });
65
46
 
66
47
  it('formats bytes with different granularities', () => {
@@ -76,6 +57,11 @@ describe('util helpers', () => {
76
57
  assert.strictEqual(i18n.formatBytes(15.12345, granularity), `15${NBSP}bytes`);
77
58
  assert.strictEqual(i18n.formatBytes(15.54321, granularity), `16${NBSP}bytes`);
78
59
 
60
+ granularity = 0.5;
61
+ assert.strictEqual(i18n.formatBytes(15.0, granularity), `15.0${NBSP}bytes`);
62
+ assert.strictEqual(i18n.formatBytes(15.12345, granularity), `15.0${NBSP}bytes`);
63
+ assert.strictEqual(i18n.formatBytes(15.54321, granularity), `15.5${NBSP}bytes`);
64
+
79
65
  granularity = 0.1;
80
66
  assert.strictEqual(i18n.formatBytes(15.0, granularity), `15.0${NBSP}bytes`);
81
67
  assert.strictEqual(i18n.formatBytes(15.12345, granularity), `15.1${NBSP}bytes`);
@@ -87,21 +73,6 @@ describe('util helpers', () => {
87
73
  assert.strictEqual(i18n.formatBytes(15.19999, granularity), `15.20${NBSP}bytes`);
88
74
  });
89
75
 
90
- it('formats bytes with invalid granularity', () => {
91
- const i18n = new I18n('en', {...Util.UIStrings});
92
- const granularity = 0.5;
93
- const originalWarn = console.warn;
94
-
95
- try {
96
- console.warn = () => {};
97
- assert.strictEqual(i18n.formatBytes(15.0, granularity), `15${NBSP}bytes`);
98
- assert.strictEqual(i18n.formatBytes(15.12345, granularity), `15${NBSP}bytes`);
99
- assert.strictEqual(i18n.formatBytes(15.54321, granularity), `16${NBSP}bytes`);
100
- } finally {
101
- console.warn = originalWarn;
102
- }
103
- });
104
-
105
76
  it('formats kibibytes with different granularities', () => {
106
77
  const i18n = new I18n('en', {...Util.UIStrings});
107
78
 
@@ -122,7 +93,7 @@ describe('util helpers', () => {
122
93
 
123
94
  it('formats ms', () => {
124
95
  const i18n = new I18n('en', {...Util.UIStrings});
125
- assert.equal(i18n.formatMilliseconds(123, 10), `120${NBSP}ms`);
96
+ assert.equal(i18n.formatMilliseconds(123), `120${NBSP}ms`);
126
97
  assert.equal(i18n.formatMilliseconds(2456.5, 0.1), `2,456.5${NBSP}ms`);
127
98
  assert.equal(i18n.formatMilliseconds(0.000001), `0${NBSP}ms`);
128
99
  assert.equal(i18n.formatMilliseconds(-0.000001), `0${NBSP}ms`);
@@ -130,25 +101,9 @@ describe('util helpers', () => {
130
101
 
131
102
  it('formats a duration', () => {
132
103
  const i18n = new I18n('en', {...Util.UIStrings});
133
- assert.equal(i18n.formatDuration(60 * 1000), '1m');
134
- assert.equal(i18n.formatDuration(60 * 60 * 1000 + 5000), '1h 5s');
135
- assert.equal(i18n.formatDuration(28 * 60 * 60 * 1000 + 5000), '1d 4h 5s');
136
- });
137
-
138
- it('formats a duration based on locale', () => {
139
- let i18n = new I18n('de', {...Util.UIStrings});
140
- assert.equal(i18n.formatDuration(60 * 1000), `1${NBSP}Min.`);
141
- assert.equal(i18n.formatDuration(60 * 60 * 1000 + 5000), `1${NBSP}Std. 5${NBSP}Sek.`);
142
- assert.equal(
143
- i18n.formatDuration(28 * 60 * 60 * 1000 + 5000), `1${NBSP}T 4${NBSP}Std. 5${NBSP}Sek.`);
144
-
145
- // Yes, this is actually backwards (s h d).
146
- i18n = new I18n('ar', {...Util.UIStrings});
147
- /* eslint-disable no-irregular-whitespace */
148
- assert.equal(i18n.formatDuration(60 * 1000), `١${NBSP}د`);
149
- assert.equal(i18n.formatDuration(60 * 60 * 1000 + 5000), `١${NBSP}س ٥${NBSP}ث`);
150
- assert.equal(i18n.formatDuration(28 * 60 * 60 * 1000 + 5000), `١ ي ٤ س ٥ ث`);
151
- /* eslint-enable no-irregular-whitespace */
104
+ assert.equal(i18n.formatDuration(60 * 1000), `1${NBSP}m`);
105
+ assert.equal(i18n.formatDuration(60 * 60 * 1000 + 5000), `1${NBSP}h 5${NBSP}s`);
106
+ assert.equal(i18n.formatDuration(28 * 60 * 60 * 1000 + 5000), `1${NBSP}d 4${NBSP}h 5${NBSP}s`);
152
107
  });
153
108
 
154
109
  it('formats numbers based on locale', () => {
@@ -156,10 +111,10 @@ describe('util helpers', () => {
156
111
  const number = 12346.858558;
157
112
 
158
113
  const i18n = new I18n('de', {...Util.UIStrings});
159
- assert.strictEqual(i18n.formatNumber(number), '12.346,859');
160
- assert.strictEqual(i18n.formatBytesToKiB(number, 0.1), `12,1${NBSP}KiB`);
161
- assert.strictEqual(i18n.formatMilliseconds(number, 10), `12.350${NBSP}ms`);
162
- assert.strictEqual(i18n.formatSeconds(number), `12,347${NBSP}Sek.`);
114
+ assert.strictEqual(i18n.formatNumber(number), '12.346,9');
115
+ assert.strictEqual(i18n.formatBytesToKiB(number), `12,1${NBSP}KiB`);
116
+ assert.strictEqual(i18n.formatMilliseconds(number), `12.350${NBSP}ms`);
117
+ assert.strictEqual(i18n.formatSeconds(number), `12,3${NBSP}s`);
163
118
  });
164
119
 
165
120
  it('uses decimal comma with en-XA test locale', () => {
@@ -167,10 +122,10 @@ describe('util helpers', () => {
167
122
  const number = 12346.858558;
168
123
 
169
124
  const i18n = new I18n('en-XA', {...Util.UIStrings});
170
- assert.strictEqual(i18n.formatNumber(number), '12.346,859');
171
- assert.strictEqual(i18n.formatBytesToKiB(number, 0.1), `12,1${NBSP}KiB`);
172
- assert.strictEqual(i18n.formatMilliseconds(number, 100), `12.300${NBSP}ms`);
173
- assert.strictEqual(i18n.formatSeconds(number, 1), `12${NBSP}Sek.`);
125
+ assert.strictEqual(i18n.formatNumber(number), '12.346,9');
126
+ assert.strictEqual(i18n.formatBytesToKiB(number), `12,1${NBSP}KiB`);
127
+ assert.strictEqual(i18n.formatMilliseconds(number), `12.350${NBSP}ms`);
128
+ assert.strictEqual(i18n.formatSeconds(number), `12,3${NBSP}s`);
174
129
  });
175
130
 
176
131
  it('should not crash on unknown locales', () => {
@@ -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
 
@@ -357,7 +360,7 @@ Array [
357
360
  }
358
361
  });
359
362
 
360
- it('uses null if the metric\'s value is undefined', () => {
363
+ it('uses null if the metric is missing its value', () => {
361
364
  const categoryClone = JSON.parse(JSON.stringify(category));
362
365
  const lcp = categoryClone.auditRefs.find(audit => audit.id === 'largest-contentful-paint');
363
366
  lcp.result.numericValue = undefined;
@@ -365,16 +368,6 @@ Array [
365
368
  const href = renderer._getScoringCalculatorHref(categoryClone.auditRefs);
366
369
  expect(href).toContain('LCP=null');
367
370
  });
368
-
369
- it('uses null if the metric\'s value is null (LR)', () => {
370
- const categoryClone = JSON.parse(JSON.stringify(category));
371
- const lcp = categoryClone.auditRefs.find(audit => audit.id === 'largest-contentful-paint');
372
- // In LR, we think there might be some case where undefined becomes null, but we can't prove it.
373
- lcp.result.numericValue = null;
374
- lcp.result.score = null;
375
- const href = renderer._getScoringCalculatorHref(categoryClone.auditRefs);
376
- expect(href).toContain('LCP=null');
377
- });
378
371
  });
379
372
 
380
373
  // This is done all in CSS, but tested here.
@@ -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,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 puppeteer from 'puppeteer';
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,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,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 fs from 'fs';
8
9
 
@@ -11,6 +12,8 @@ import pako from 'pako';
11
12
  import {TextEncoding} from '../../renderer/text-encoding.js';
12
13
  import {LH_ROOT} from '../../../root.js';
13
14
 
15
+ /* eslint-env jest */
16
+
14
17
  describe('TextEncoding', () => {
15
18
  beforeAll(() => {
16
19
  global.window = {pako};
@@ -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
 
@@ -10,6 +11,8 @@ import {Util} from '../../renderer/util.js';
10
11
  import {I18n} from '../../renderer/i18n.js';
11
12
  import sampleResult from '../../../lighthouse-core/test/results/sample_v2.json';
12
13
 
14
+ /* eslint-env jest */
15
+
13
16
  describe('util helpers', () => {
14
17
  beforeEach(() => {
15
18
  Util.i18n = new I18n('en', {...Util.UIStrings});
@@ -54,7 +57,7 @@ describe('util helpers', () => {
54
57
  });
55
58
 
56
59
  // eslint-disable-next-line max-len
57
- assert.equal(descriptions.networkThrottling, '565\xa0ms HTTP RTT, 1,400\xa0kb/s down, 600\xa0kb/s up (DevTools)');
60
+ assert.equal(descriptions.networkThrottling, '565\xa0ms HTTP RTT, 1,400\xa0Kbps down, 600\xa0Kbps up (DevTools)');
58
61
  assert.equal(descriptions.cpuThrottling, '4.5x slowdown (DevTools)');
59
62
  });
60
63
 
@@ -69,7 +72,7 @@ describe('util helpers', () => {
69
72
  });
70
73
 
71
74
  // eslint-disable-next-line max-len
72
- assert.equal(descriptions.networkThrottling, '150\xa0ms TCP RTT, 1,600\xa0kb/s throughput (Simulated)');
75
+ assert.equal(descriptions.networkThrottling, '150\xa0ms TCP RTT, 1,600\xa0Kbps throughput (Simulated)');
73
76
  assert.equal(descriptions.cpuThrottling, '2x slowdown (Simulated)');
74
77
  });
75
78
 
@@ -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
  /** @fileoverview This file exercises two LH reports within the same DOM. */
8
9
 
@@ -65,8 +66,6 @@ async function renderLHReport() {
65
66
  metaItemsEl,
66
67
  reportRootEl.querySelector('.lh-buttons')
67
68
  );
68
- reportRootEl.querySelector('.lh-metrics-container')?.closest('.lh-category')?.classList
69
- .add('lh--hoisted-meta');
70
69
  }
71
70
 
72
71
  container.append(reportRootEl);