lighthouse 9.5.0-dev.20230111 → 9.5.0-dev.20230112

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 (37) hide show
  1. package/cli/bin.js +6 -6
  2. package/cli/run.js +1 -1
  3. package/cli/test/smokehouse/lighthouse-runners/bundle.js +9 -9
  4. package/cli/test/smokehouse/lighthouse-runners/cli.js +7 -7
  5. package/cli/test/smokehouse/lighthouse-runners/devtools.js +3 -3
  6. package/cli/test/smokehouse/readme.md +1 -1
  7. package/cli/test/smokehouse/smokehouse.js +13 -13
  8. package/core/audits/seo/is-crawlable.js +114 -42
  9. package/core/config/config-helpers.js +11 -11
  10. package/core/config/config-plugin.js +2 -2
  11. package/core/config/config.js +15 -15
  12. package/core/config/default-config.js +2 -2
  13. package/core/config/desktop-config.js +1 -1
  14. package/core/config/experimental-config.js +1 -1
  15. package/core/config/full-config.js +1 -1
  16. package/core/config/lr-desktop-config.js +1 -1
  17. package/core/config/lr-mobile-config.js +1 -1
  18. package/core/config/perf-config.js +1 -1
  19. package/core/config/validation.js +4 -4
  20. package/core/gather/navigation-runner.js +1 -1
  21. package/core/gather/snapshot-runner.js +1 -1
  22. package/core/gather/timespan-runner.js +1 -1
  23. package/core/index.js +10 -10
  24. package/core/legacy/config/config.js +23 -23
  25. package/core/legacy/config/legacy-default-config.js +1 -1
  26. package/core/user-flow.js +3 -3
  27. package/core/util.cjs +13 -3
  28. package/dist/report/bundle.esm.js +13 -3
  29. package/dist/report/flow.js +1 -1
  30. package/dist/report/standalone.js +1 -1
  31. package/package.json +1 -1
  32. package/report/renderer/util.js +13 -3
  33. package/report/test/generator/report-generator-test.js +1 -1
  34. package/report/test/renderer/util-test.js +2 -0
  35. package/types/config.d.ts +18 -18
  36. package/types/smokehouse.d.ts +2 -2
  37. package/types/user-flow.d.ts +1 -1
@@ -512,14 +512,24 @@ class Util {
512
512
  summary = cpuThrottling = networkThrottling = Util.i18n.strings.runtimeUnknown;
513
513
  }
514
514
 
515
+ // devtools-entry.js always sets `screenEmulation.disabled` when using mobile emulation,
516
+ // because we handle the emulation outside of Lighthouse. Since the screen truly is emulated
517
+ // as a mobile device, ignore `.disabled` in devtools and just check the form factor
518
+ const isScreenEmulationDisabled = settings.channel === 'devtools' ?
519
+ false :
520
+ settings.screenEmulation.disabled;
521
+ const isScreenEmulationMobile = settings.channel === 'devtools' ?
522
+ settings.formFactor === 'mobile' :
523
+ settings.screenEmulation.mobile;
524
+
515
525
  let deviceEmulation = Util.i18n.strings.runtimeMobileEmulation;
516
- if (settings.screenEmulation.disabled) {
526
+ if (isScreenEmulationDisabled) {
517
527
  deviceEmulation = Util.i18n.strings.runtimeNoEmulation;
518
- } else if (!settings.screenEmulation.mobile) {
528
+ } else if (!isScreenEmulationMobile) {
519
529
  deviceEmulation = Util.i18n.strings.runtimeDesktopEmulation;
520
530
  }
521
531
 
522
- const screenEmulation = settings.screenEmulation.disabled ?
532
+ const screenEmulation = isScreenEmulationDisabled ?
523
533
  undefined :
524
534
  // eslint-disable-next-line max-len
525
535
  `${settings.screenEmulation.width}x${settings.screenEmulation.height}, DPR ${settings.screenEmulation.deviceScaleFactor}`;
@@ -108,7 +108,7 @@ describe('ReportGenerator', () => {
108
108
  category,score
109
109
  \\"performance\\",\\"0.26\\"
110
110
  \\"accessibility\\",\\"0.77\\"
111
- \\"best-practices\\",\\"0.27\\"
111
+ \\"best-practices\\",\\"0.25\\"
112
112
  \\"seo\\",\\"0.67\\"
113
113
  \\"pwa\\",\\"0.33\\"
114
114
 
@@ -37,8 +37,10 @@ describe('util helpers', () => {
37
37
  /* eslint-disable max-len */
38
38
  assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: false, mobile: true}}), 'Emulated Moto G4');
39
39
  assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: true, mobile: true}}), 'No emulation');
40
+ assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: true, mobile: true}, channel: 'devtools'}), 'Emulated Moto G4');
40
41
  assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: false, mobile: false}}), 'Emulated Desktop');
41
42
  assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: true, mobile: false}}), 'No emulation');
43
+ assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: true, mobile: true}, channel: 'devtools'}), 'Emulated Desktop');
42
44
  /* eslint-enable max-len */
43
45
  });
44
46
 
package/types/config.d.ts CHANGED
@@ -14,25 +14,25 @@ interface ClassOf<T> {
14
14
  new (): T;
15
15
  }
16
16
 
17
- declare module Config {
18
- /**
19
- * The pre-normalization Lighthouse Config format.
20
- */
21
- interface Json {
22
- extends?: 'lighthouse:default' | string;
23
- settings?: SharedFlagsSettings;
24
- audits?: Config.AuditJson[] | null;
25
- categories?: Record<string, CategoryJson> | null;
26
- groups?: Record<string, Config.GroupJson> | null;
27
- plugins?: Array<string>;
28
-
29
- // Fraggle Rock Only
30
- artifacts?: ArtifactJson[] | null;
31
-
32
- // Legacy Only
33
- passes?: PassJson[] | null;
34
- }
17
+ /**
18
+ * The Lighthouse Config format.
19
+ */
20
+ interface Config {
21
+ extends?: 'lighthouse:default' | string;
22
+ settings?: SharedFlagsSettings;
23
+ audits?: Config.AuditJson[] | null;
24
+ categories?: Record<string, Config.CategoryJson> | null;
25
+ groups?: Record<string, Config.GroupJson> | null;
26
+ plugins?: Array<string>;
27
+
28
+ // Fraggle Rock Only
29
+ artifacts?: Config.ArtifactJson[] | null;
30
+
31
+ // Legacy Only
32
+ passes?: Config.PassJson[] | null;
33
+ }
35
34
 
35
+ declare module Config {
36
36
  /**
37
37
  * The normalized and fully resolved legacy config.
38
38
  */
@@ -37,7 +37,7 @@ declare global {
37
37
  /** Expected test results. */
38
38
  expectations: ExpectedRunnerResult;
39
39
  /** An optional custom config. If none is present, uses the default Lighthouse config. */
40
- config?: Config.Json;
40
+ config?: Config;
41
41
  /** If test is performance sensitive, set to true so that it won't be run parallel to other tests. */
42
42
  runSerially?: boolean;
43
43
  }
@@ -52,7 +52,7 @@ declare global {
52
52
  {expectations: Smokehouse.ExpectedRunnerResult | Array<Smokehouse.ExpectedRunnerResult>}
53
53
 
54
54
  export type LighthouseRunner =
55
- {runnerName?: string} & ((url: string, configJson?: Config.Json, runnerOptions?: {isDebug?: boolean; useLegacyNavigation?: boolean}) => Promise<{lhr: LHResult, artifacts: Artifacts, log: string}>);
55
+ {runnerName?: string} & ((url: string, config?: Config, runnerOptions?: {isDebug?: boolean; useLegacyNavigation?: boolean}) => Promise<{lhr: LHResult, artifacts: Artifacts, log: string}>);
56
56
 
57
57
  export interface SmokehouseOptions {
58
58
  /** If true, performs extra logging from the test runs. */
@@ -8,7 +8,7 @@ declare module UserFlow {
8
8
 
9
9
  export interface Options {
10
10
  /** Config to use for each flow step. */
11
- config?: LH.Config.Json;
11
+ config?: LH.Config;
12
12
  /** Base flags to use for each flow step. Step specific flags will override these flags. */
13
13
  flags?: LH.Flags;
14
14
  /** Display name for this user flow. */