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
@@ -132,7 +132,7 @@ const SummaryTooltip: FunctionComponent<{
132
132
  {
133
133
  !displayAsFraction && category.score !== null && <>
134
134
  <span> · </span>
135
- <span>{i18n.formatInteger(category.score * 100)}</span>
135
+ <span>{i18n.formatNumber(category.score * 100)}</span>
136
136
  </>
137
137
  }
138
138
  </div>
package/jest.config.js CHANGED
@@ -6,7 +6,7 @@
6
6
  'use strict';
7
7
 
8
8
  module.exports = {
9
- setupFilesAfterEnv: ['./lighthouse-core/test/jest-setup/setup.js'],
9
+ setupFilesAfterEnv: ['./lighthouse-core/test/test-utils.js'],
10
10
  testEnvironment: 'node',
11
11
  testMatch: [
12
12
  '**/lighthouse-core/**/*-test.js',
@@ -3,8 +3,12 @@
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
  module.exports = {
9
+ env: {
10
+ browser: true,
11
+ },
8
12
  rules: {
9
13
  // TODO(esmodules): move to root eslint when all code is ESM
10
14
  // or when this is resolved: https://github.com/import-js/eslint-plugin-import/issues/2214
@@ -22,7 +26,4 @@ module.exports = {
22
26
  'import/group-exports': 2,
23
27
  'import/exports-last': 2,
24
28
  },
25
- parserOptions: {
26
- sourceType: 'module',
27
- },
28
29
  };
@@ -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 The relationship between these CLI modules:
@@ -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-disable max-len */
8
9
 
@@ -123,10 +124,10 @@ function getFlags(manualArgv, options = {}) {
123
124
  type: 'boolean',
124
125
  describe: 'Pause after page load to wait for permission to continue the run, evaluate `continueLighthouseRun` in the console to continue.',
125
126
  },
126
- 'legacy-navigation': {
127
+ 'fraggle-rock': {
127
128
  type: 'boolean',
128
129
  default: false,
129
- describe: '[DEPRECATED] Use the legacy navigation runner to gather results. Only use this if you are using a pre-10.0 custom Lighthouse config, or if Lighthouse unexpectedly fails after updating to 10.0. Please file a bug if you need this flag for Lighthouse to work.',
130
+ describe: '[EXPERIMENTAL] Use the new Fraggle Rock navigation runner to gather results.',
130
131
  },
131
132
  'additional-trace-categories': {
132
133
  type: 'string',
@@ -177,7 +178,7 @@ function getFlags(manualArgv, options = {}) {
177
178
  },
178
179
  'enable-error-reporting': {
179
180
  type: 'boolean',
180
- describe: 'Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://github.com/GoogleChrome/lighthouse/blob/master/docs/error-reporting.md',
181
+ describe: 'Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://git.io/vFFTO',
181
182
  },
182
183
  'gather-mode': {
183
184
  alias: 'G',
@@ -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
  export {listAudits} from './list-audits.js';
8
9
  export {listTraceCategories} from './list-trace-categories.js';
@@ -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 lighthouse from '../../lighthouse-core/index.js';
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
  import locales from '../../shared/localization/locales.js';
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
  import lighthouse from '../../lighthouse-core/index.js';
8
9
 
@@ -4,6 +4,7 @@
4
4
  * 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
5
5
  * 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.
6
6
  */
7
+ 'use strict';
7
8
 
8
9
  import {begin} from './bin.js';
9
10
 
@@ -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
 
@@ -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-disable no-console */
8
9
 
@@ -193,6 +194,27 @@ async function potentiallyKillChrome(launchedChrome) {
193
194
  });
194
195
  }
195
196
 
197
+ /**
198
+ * @param {string} url
199
+ * @param {LH.CliFlags} flags
200
+ * @param {LH.Config.Json|undefined} config
201
+ * @param {ChromeLauncher.LaunchedChrome} launchedChrome
202
+ * @return {Promise<LH.RunnerResult|undefined>}
203
+ */
204
+ async function runLighthouseWithFraggleRock(url, flags, config, launchedChrome) {
205
+ const fraggleRock = (await import('../lighthouse-core/fraggle-rock/api.js')).default;
206
+ const puppeteer = (await import('puppeteer')).default;
207
+ const browser = await puppeteer.connect({browserURL: `http://localhost:${launchedChrome.port}`});
208
+ const page = await browser.newPage();
209
+ flags.channel = 'fraggle-rock-cli';
210
+ const configContext = {
211
+ configPath: flags.configPath,
212
+ settingsOverrides: flags,
213
+ logLevel: flags.logLevel,
214
+ };
215
+ return fraggleRock.navigation(url, {page, config, configContext});
216
+ }
217
+
196
218
  /**
197
219
  * @param {string} url
198
220
  * @param {LH.CliFlags} flags
@@ -225,15 +247,8 @@ async function runLighthouse(url, flags, config) {
225
247
  flags.port = launchedChrome.port;
226
248
  }
227
249
 
228
- if (flags.legacyNavigation) {
229
- log.warn('CLI', 'Legacy navigation CLI is deprecated');
230
- flags.channel = 'legacy-navigation-cli';
231
- } else {
232
- flags.channel = 'cli';
233
- }
234
-
235
- const runnerResult = flags.legacyNavigation ?
236
- await lighthouse.legacyNavigation(url, flags, config) :
250
+ const runnerResult = flags.fraggleRock && launchedChrome ?
251
+ await runLighthouseWithFraggleRock(url, flags, config, launchedChrome) :
237
252
  await lighthouse(url, flags, config);
238
253
 
239
254
  // If in gatherMode only, there will be no runnerResult.
@@ -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 Configstore from 'configstore';
8
9
  import Confirm from 'enquirer';
@@ -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 a11y from './test-definitions/a11y.js';
8
9
  import byteEfficiency from './test-definitions/byte-efficiency.js';
@@ -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
  * COMPAT: update from the old TestDefn format (array of `expectations` per
@@ -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 Smoke test runner.
@@ -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 A smokehouse frontend for running within a node process.
@@ -4,6 +4,7 @@
4
4
  * 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
5
5
  * 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.
6
6
  */
7
+ 'use strict';
7
8
 
8
9
  /**
9
10
  * @fileoverview A smokehouse frontend for running from the command line. Parse
@@ -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
  * An extension of Error that includes any stdout or stderr from a child
@@ -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
  * A class that maintains a concurrency pool to coordinate many jobs that should
@@ -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
  * A simple buffered log to use in place of `console`.
@@ -3,98 +3,59 @@
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 A runner that launches Chrome and executes Lighthouse via a
9
10
  * bundle to test that bundling has produced correct and runnable code.
10
11
  * Currently uses `lighthouse-dt-bundle.js`.
11
- * Runs in a worker to avoid messing up marky's global state.
12
12
  */
13
13
 
14
14
  import fs from 'fs';
15
- import os from 'os';
16
- import {Worker, isMainThread, parentPort, workerData} from 'worker_threads';
17
- import {once} from 'events';
18
15
 
19
- import puppeteer from 'puppeteer-core';
20
16
  import ChromeLauncher from 'chrome-launcher';
21
17
 
22
18
  import ChromeProtocol from '../../../../lighthouse-core/gather/connections/cri.js';
23
19
  import {LH_ROOT} from '../../../../root.js';
24
- import {loadArtifacts, saveArtifacts} from '../../../../lighthouse-core/lib/asset-saver.js';
25
20
 
26
- // This runs only in the worker. The rest runs on the main thread.
27
- if (!isMainThread && parentPort) {
28
- (async () => {
29
- const {url, configJson, testRunnerOptions} = workerData;
30
- try {
31
- const result = await runBundledLighthouse(url, configJson, testRunnerOptions);
32
- // Save to assets directory because LighthouseError won't survive postMessage.
33
- const assetsDir = fs.mkdtempSync(os.tmpdir() + '/smoke-bundle-assets-');
34
- await saveArtifacts(result.artifacts, assetsDir);
35
- const value = {
36
- lhr: result.lhr,
37
- assetsDir,
38
- };
39
- parentPort?.postMessage({type: 'result', value});
40
- } catch (err) {
41
- console.error(err);
42
- parentPort?.postMessage({type: 'error', value: err});
43
- }
44
- })();
21
+ const originalRequire = global.require;
22
+ if (typeof globalThis === 'undefined') {
23
+ // @ts-expect-error - exposing for loading of dt-bundle.
24
+ global.globalThis = global;
45
25
  }
46
26
 
47
- /**
48
- * @param {string} url
49
- * @param {LH.Config.Json|undefined} configJson
50
- * @param {{isDebug?: boolean, useFraggleRock?: boolean}} testRunnerOptions
51
- * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts}>}
52
- */
53
- async function runBundledLighthouse(url, configJson, testRunnerOptions) {
54
- if (isMainThread || !parentPort) {
55
- throw new Error('must be called in worker');
56
- }
57
-
58
- const originalBuffer = global.Buffer;
59
- const originalRequire = global.require;
60
- if (typeof globalThis === 'undefined') {
61
- // @ts-expect-error - exposing for loading of dt-bundle.
62
- global.globalThis = global;
63
- }
64
-
65
- // Load bundle, which creates a `global.runBundledLighthouse`.
66
- eval(fs.readFileSync(LH_ROOT + '/dist/lighthouse-dt-bundle.js', 'utf-8'));
27
+ // Load bundle, which creates a `global.runBundledLighthouse`.
28
+ eval(fs.readFileSync(LH_ROOT + '/dist/lighthouse-dt-bundle.js', 'utf-8'));
67
29
 
68
- global.require = originalRequire;
69
- global.Buffer = originalBuffer;
30
+ global.require = originalRequire;
70
31
 
71
- /** @type {import('../../../../lighthouse-core/index.js')} */
72
- // @ts-expect-error - not worth giving test global an actual type.
73
- const lighthouse = global.runBundledLighthouse;
32
+ /** @type {import('../../../../lighthouse-core/index.js')} */
33
+ // @ts-expect-error - not worth giving test global an actual type.
34
+ const lighthouse = global.runBundledLighthouse;
74
35
 
36
+ /**
37
+ * Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
38
+ * @param {string} url
39
+ * @param {LH.Config.Json=} configJson
40
+ * @param {{isDebug?: boolean}=} testRunnerOptions
41
+ * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
42
+ */
43
+ async function runLighthouse(url, configJson, testRunnerOptions = {}) {
75
44
  // Launch and connect to Chrome.
76
45
  const launchedChrome = await ChromeLauncher.launch();
77
46
  const port = launchedChrome.port;
47
+ const connection = new ChromeProtocol(port);
78
48
 
79
- // Run Lighthouse.
80
49
  try {
50
+ // Run Lighthouse.
81
51
  const logLevel = testRunnerOptions.isDebug ? 'info' : undefined;
82
- let runnerResult;
83
- if (testRunnerOptions.useFraggleRock) {
84
- // Puppeteer is not included in the bundle, we must create the page here.
85
- const browser = await puppeteer.connect({browserURL: `http://localhost:${port}`});
86
- const page = await browser.newPage();
87
- runnerResult = await lighthouse(url, {port, logLevel}, configJson, page);
88
- } else {
89
- const connection = new ChromeProtocol(port);
90
- runnerResult =
91
- await lighthouse.legacyNavigation(url, {port, logLevel}, configJson, connection);
92
- }
52
+ const runnerResult = await lighthouse(url, {port, logLevel}, configJson, connection);
93
53
  if (!runnerResult) throw new Error('No runnerResult');
94
54
 
95
55
  return {
96
56
  lhr: runnerResult.lhr,
97
57
  artifacts: runnerResult.artifacts,
58
+ log: '', // TODO: if want to run in parallel, need to capture lighthouse-logger output.
98
59
  };
99
60
  } finally {
100
61
  // Clean up and return results.
@@ -102,53 +63,6 @@ async function runBundledLighthouse(url, configJson, testRunnerOptions) {
102
63
  }
103
64
  }
104
65
 
105
- /**
106
- * Launch Chrome and do a full Lighthouse run via the Lighthouse DevTools bundle.
107
- * @param {string} url
108
- * @param {LH.Config.Json=} configJson
109
- * @param {{isDebug?: boolean, useFraggleRock?: boolean}=} testRunnerOptions
110
- * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
111
- */
112
- async function runLighthouse(url, configJson, testRunnerOptions = {}) {
113
- /** @type {string[]} */
114
- const logs = [];
115
- const worker = new Worker(new URL(import.meta.url), {
116
- stdout: true,
117
- stderr: true,
118
- workerData: {url, configJson, testRunnerOptions},
119
- });
120
- worker.stdout.setEncoding('utf8');
121
- worker.stderr.setEncoding('utf8');
122
- worker.stdout.addListener('data', (data) => {
123
- process.stdout.write(data);
124
- logs.push(`STDOUT: ${data}`);
125
- });
126
- worker.stderr.addListener('data', (data) => {
127
- process.stderr.write(data);
128
- logs.push(`STDERR: ${data}`);
129
- });
130
- const [workerResponse] = await once(worker, 'message');
131
- const log = logs.join('') + '\n';
132
-
133
- if (workerResponse.type === 'error') {
134
- new Error(`Worker returned an error: ${workerResponse.value}\nLog:\n${log}`);
135
- }
136
-
137
- const result = workerResponse.value;
138
- if (!result.lhr || !result.assetsDir) {
139
- throw new Error(`invalid response from worker:\n${JSON.stringify(result, null, 2)}`);
140
- }
141
-
142
- const artifacts = loadArtifacts(result.assetsDir);
143
- fs.rmSync(result.assetsDir, {recursive: true});
144
-
145
- return {
146
- lhr: result.lhr,
147
- artifacts,
148
- log,
149
- };
150
- }
151
-
152
66
  export {
153
67
  runLighthouse,
154
68
  };
@@ -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 A runner that executes Lighthouse via the Lighthouse CLI to
@@ -77,14 +78,14 @@ async function internalRun(url, tmpPath, configJson, options) {
77
78
  '--output=json',
78
79
  `-G=${artifactsDirectory}`,
79
80
  `-A=${artifactsDirectory}`,
81
+ '--quiet',
80
82
  '--port=0',
81
83
  '--quiet',
82
84
  ];
83
85
 
84
86
  if (useFraggleRock) {
87
+ args.push('--fraggle-rock');
85
88
  configJson = convertToFraggleRockConfig(configJson);
86
- } else {
87
- args.push('--legacy-navigation');
88
89
  }
89
90
 
90
91
  // Config can be optionally provided.
@@ -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 A runner that launches Chrome and executes Lighthouse via DevTools.
@@ -18,51 +19,45 @@ const devtoolsDir =
18
19
  process.env.DEVTOOLS_PATH || `${LH_ROOT}/.tmp/chromium-web-tests/devtools/devtools-frontend`;
19
20
 
20
21
  /**
21
- * @param {string[]} logs
22
22
  * @param {string} command
23
23
  * @param {string[]} args
24
24
  */
25
- async function spawnAndLog(logs, command, args) {
25
+ async function spawnAndLog(command, args) {
26
+ let log = '';
27
+
26
28
  /** @type {Promise<void>} */
27
- const promise = new Promise((resolve) => {
29
+ const promise = new Promise((resolve, reject) => {
28
30
  const spawnHandle = spawn(command, args);
29
31
  spawnHandle.on('close', code => {
30
- if (code) {
31
- logs.push(`[FAILURE] Command exited with code: ${code}\n`);
32
- } else {
33
- logs.push('[SUCCESS] Command exited with code: 0\n');
34
- }
35
- resolve();
36
- });
37
- spawnHandle.on('error', (error) => {
38
- logs.push(`ERROR: ${error.toString()}`);
32
+ if (code === 0) resolve();
33
+ else reject(new Error(`Command exited with code ${code}`));
39
34
  });
40
- spawnHandle.stdout.setEncoding('utf8');
35
+ spawnHandle.on('error', reject);
41
36
  spawnHandle.stdout.on('data', data => {
42
- process.stdout.write(data);
43
- logs.push(`STDOUT: ${data}`);
37
+ console.log(data.toString());
38
+ log += `STDOUT: ${data.toString()}`;
44
39
  });
45
- spawnHandle.stderr.setEncoding('utf8');
46
40
  spawnHandle.stderr.on('data', data => {
47
- process.stderr.write(data);
48
- logs.push(`STDERR: ${data}`);
41
+ console.log(data.toString());
42
+ log += `STDERR: ${data.toString()}`;
49
43
  });
50
44
  });
51
45
  await promise;
46
+
47
+ return log;
52
48
  }
53
49
 
54
50
  /** @type {Promise<void>} */
55
51
  let buildDevtoolsPromise;
56
52
  /**
57
- * @param {string[]} logs
58
53
  * Download/pull latest DevTools, build Lighthouse for DevTools, roll to DevTools, and build DevTools.
59
54
  */
60
- async function buildDevtools(logs) {
55
+ async function buildDevtools() {
61
56
  if (process.env.CI) return;
62
57
 
63
58
  process.env.DEVTOOLS_PATH = devtoolsDir;
64
- await spawnAndLog(logs, 'bash', ['lighthouse-core/test/chromium-web-tests/download-devtools.sh']);
65
- await spawnAndLog(logs, 'bash', ['lighthouse-core/test/chromium-web-tests/roll-devtools.sh']);
59
+ await spawnAndLog('bash', ['lighthouse-core/test/chromium-web-tests/download-devtools.sh']);
60
+ await spawnAndLog('bash', ['lighthouse-core/test/chromium-web-tests/roll-devtools.sh']);
66
61
  }
67
62
 
68
63
  /**
@@ -76,10 +71,7 @@ async function buildDevtools(logs) {
76
71
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
77
72
  */
78
73
  async function runLighthouse(url, configJson, testRunnerOptions = {}) {
79
- /** @type {string[]} */
80
- const logs = [];
81
-
82
- if (!buildDevtoolsPromise) buildDevtoolsPromise = buildDevtools(logs);
74
+ if (!buildDevtoolsPromise) buildDevtoolsPromise = buildDevtools();
83
75
  await buildDevtoolsPromise;
84
76
 
85
77
  const outputDir = fs.mkdtempSync(os.tmpdir() + '/lh-smoke-cdt-runner-');
@@ -96,7 +88,7 @@ async function runLighthouse(url, configJson, testRunnerOptions = {}) {
96
88
  args.push('--config', JSON.stringify(configJson));
97
89
  }
98
90
 
99
- await spawnAndLog(logs, 'yarn', args);
91
+ const log = await spawnAndLog('yarn', args);
100
92
  const lhr = JSON.parse(fs.readFileSync(`${outputDir}/lhr-0.json`, 'utf-8'));
101
93
  const artifacts = JSON.parse(fs.readFileSync(`${outputDir}/artifacts-0.json`, 'utf-8'));
102
94
 
@@ -106,7 +98,6 @@ async function runLighthouse(url, configJson, testRunnerOptions = {}) {
106
98
  fs.rmSync(outputDir, {recursive: true, force: true});
107
99
  }
108
100
 
109
- const log = logs.join('') + '\n';
110
101
  return {lhr, artifacts, log};
111
102
  }
112
103
 
@@ -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 An assertion library for comparing smoke-test expectations
@@ -218,10 +219,10 @@ function makeComparison(name, actualResult, expectedResult) {
218
219
  * @param {LocalConsole} localConsole
219
220
  * @param {LH.Result} lhr
220
221
  * @param {Smokehouse.ExpectedRunnerResult} expected
221
- * @param {{runner?: string, isBundled?: boolean, useFraggleRock?: boolean}=} reportOptions
222
+ * @param {{runner?: string, isBundled?: boolean}=} reportOptions
222
223
  */
223
224
  function pruneExpectations(localConsole, lhr, expected, reportOptions) {
224
- const isFraggleRock = reportOptions?.useFraggleRock;
225
+ const isFraggleRock = lhr.configSettings.channel === 'fraggle-rock-cli';
225
226
  const isBundled = reportOptions?.isBundled;
226
227
 
227
228
  /**
@@ -458,7 +459,7 @@ function reportAssertion(localConsole, assertion) {
458
459
  * summary. Returns count of passed and failed tests.
459
460
  * @param {{lhr: LH.Result, artifacts: LH.Artifacts, networkRequests?: string[]}} actual
460
461
  * @param {Smokehouse.ExpectedRunnerResult} expected
461
- * @param {{runner?: string, isDebug?: boolean, isBundled?: boolean, useFraggleRock?: boolean}=} reportOptions
462
+ * @param {{runner?: string, isDebug?: boolean, isBundled?: boolean}=} reportOptions
462
463
  * @return {{passed: number, failed: number, log: string}}
463
464
  */
464
465
  function getAssertionReport(actual, expected, reportOptions = {}) {
@@ -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 An end-to-end test runner for Lighthouse. Takes a set of smoke
@@ -161,7 +162,6 @@ async function runSmokeTest(smokeTestDefn, testOptions) {
161
162
  report = getAssertionReport(result, expectations, {
162
163
  runner: lighthouseRunner.runnerName,
163
164
  isDebug,
164
- useFraggleRock,
165
165
  });
166
166
 
167
167
  runs.push({
@@ -3,9 +3,12 @@
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 {chromiumVersionCheck, compareVersions} from './version-check.js';
8
9
 
10
+ /* eslint-env jest */
11
+
9
12
  describe('version check', () => {
10
13
  it('compareVersions', async () => {
11
14
  expect(compareVersions([100, 0, 0, 0], [100, 0, 0, 0])).toBe(0);