@code-pushup/lighthouse-plugin 0.45.1 → 0.46.0

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.
package/index.js CHANGED
@@ -1166,7 +1166,6 @@ var DEFAULT_CLI_FLAGS = {
1166
1166
  // default values extracted from
1167
1167
  // https://github.com/GoogleChrome/lighthouse/blob/7d80178c37a1b600ea8f092fc0b098029799a659/cli/cli-flags.js#L80
1168
1168
  verbose: false,
1169
- quiet: false,
1170
1169
  saveAssets: false,
1171
1170
  // needed to pass CI on linux and windows (locally it works without headless too)
1172
1171
  chromeFlags: ["--headless=shell"],
@@ -1175,6 +1174,8 @@ var DEFAULT_CLI_FLAGS = {
1175
1174
  view: false,
1176
1175
  channel: "cli",
1177
1176
  // custom overwrites in favour of the plugin
1177
+ // hide logs by default
1178
+ quiet: true,
1178
1179
  onlyAudits: [],
1179
1180
  skipAudits: [],
1180
1181
  onlyCategories: [],
@@ -1259,17 +1260,18 @@ function logUnsupportedDetails(lhrAudits, { displayCount = 3 } = {}) {
1259
1260
  );
1260
1261
  }
1261
1262
  }
1262
- function setLogLevel({
1263
+ function determineAndSetLogLevel({
1263
1264
  verbose,
1264
1265
  quiet
1265
1266
  } = {}) {
1267
+ let logLevel = "info";
1266
1268
  if (verbose) {
1267
- log.setLevel("verbose");
1269
+ logLevel = "verbose";
1268
1270
  } else if (quiet) {
1269
- log.setLevel("silent");
1270
- } else {
1271
- log.setLevel("info");
1271
+ logLevel = "silent";
1272
1272
  }
1273
+ log.setLevel(logLevel);
1274
+ return logLevel;
1273
1275
  }
1274
1276
  async function getConfig(options = {}) {
1275
1277
  const { configPath: filepath, preset } = options;
@@ -1305,13 +1307,14 @@ function createRunnerFunction(urlUnderTest, flags = DEFAULT_CLI_FLAGS) {
1305
1307
  outputPath,
1306
1308
  ...parsedFlags
1307
1309
  } = flags;
1308
- setLogLevel(parsedFlags);
1310
+ const logLevel = determineAndSetLogLevel(parsedFlags);
1309
1311
  const config = await getConfig({ configPath, preset });
1310
1312
  if (outputPath) {
1311
1313
  await ensureDirectoryExists(dirname(outputPath));
1312
1314
  }
1313
1315
  const enrichedFlags = {
1314
1316
  ...parsedFlags,
1317
+ logLevel,
1315
1318
  outputPath
1316
1319
  };
1317
1320
  const runnerResult = await runLighthouse(
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@code-pushup/lighthouse-plugin",
3
- "version": "0.45.1",
3
+ "version": "0.46.0",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@code-pushup/models": "0.45.1",
6
+ "@code-pushup/models": "0.46.0",
7
7
  "lighthouse": "^12.0.0",
8
- "@code-pushup/utils": "0.45.1",
8
+ "@code-pushup/utils": "0.46.0",
9
9
  "lighthouse-logger": "2.0.1",
10
10
  "chalk": "^5.3.0"
11
11
  },
@@ -3,13 +3,13 @@ import type { LighthouseOptions } from './types';
3
3
  export declare const DEFAULT_LIGHTHOUSE_OPTIONS: {
4
4
  onlyGroups: never[];
5
5
  verbose: false;
6
- quiet: false;
7
6
  saveAssets: false;
8
7
  chromeFlags: string[];
9
8
  port: number;
10
9
  hostname: string;
11
10
  view: false;
12
11
  channel: string;
12
+ quiet: true;
13
13
  onlyAudits: never[];
14
14
  skipAudits: never[];
15
15
  output: "json"[];
@@ -5,13 +5,13 @@ export declare const LIGHTHOUSE_GROUPS: Group[];
5
5
  export declare const LIGHTHOUSE_REPORT_NAME = "lighthouse-report.json";
6
6
  export declare const DEFAULT_CLI_FLAGS: {
7
7
  verbose: false;
8
- quiet: false;
9
8
  saveAssets: false;
10
9
  chromeFlags: string[];
11
10
  port: number;
12
11
  hostname: string;
13
12
  view: false;
14
13
  channel: string;
14
+ quiet: true;
15
15
  onlyAudits: never[];
16
16
  skipAudits: never[];
17
17
  onlyCategories: never[];
@@ -11,9 +11,10 @@ export declare const unsupportedDetailTypes: Set<string>;
11
11
  export declare function logUnsupportedDetails(lhrAudits: Result[], { displayCount }?: {
12
12
  displayCount?: number;
13
13
  }): void;
14
- export declare function setLogLevel({ verbose, quiet, }?: {
14
+ export type LighthouseLogLevel = 'verbose' | 'error' | 'info' | 'silent' | 'warn' | undefined;
15
+ export declare function determineAndSetLogLevel({ verbose, quiet, }?: {
15
16
  verbose?: boolean;
16
17
  quiet?: boolean;
17
- }): void;
18
+ }): LighthouseLogLevel;
18
19
  export type ConfigOptions = Partial<Pick<LighthouseCliFlags, 'configPath' | 'preset'>>;
19
20
  export declare function getConfig(options?: ConfigOptions): Promise<Config | undefined>;