Skip to content

Commit

Permalink
Budget fix (#67)
Browse files Browse the repository at this point in the history
* 1.10.1

* fix(cli): Fix for wrong budget type

Closes #66
  • Loading branch information
andreasonny83 authored Jul 2, 2020
1 parent 7b74e4c commit e3d7d1b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
43 changes: 18 additions & 25 deletions bin/cli
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ const cli = meow(
$ lighthouse-ci https://example.com -report=folder --config-path=configs.json
Options
-s, --silent Run Lighthouse without printing report log
--report=<path> Generate an HTML report inside a specified folder
--filename=<filename> Specify the name of the generated HTML report file (requires --report)
-json, --jsonReport Generate JSON report in addition to HTML (requires --report)
--config-path The path to the Lighthouse config JSON (read more here: https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md)
--budget-path The path to the Lighthouse budgets config JSON (read more here: https://developers.google.com/web/tools/lighthouse/audits/budgets)
--score=<threshold> Specify a score threshold for the CI to pass
--performance=<threshold> Specify a minimal performance score for the CI to pass
--pwa=<threshold> Specify a minimal pwa score for the CI to pass
--accessibility=<threshold> Specify a minimal accessibility score for the CI to pass
--best-practice=<threshold> [DEPRECATED] Use best-practices instead
--best-practices=<threshold> Specify a minimal best-practice score for the CI to pass
--seo=<threshold> Specify a minimal seo score for the CI to pass
--fail-on-budgets Specify CI should fail if budgets are exceeded
--budget.<counts|sizes>.<type> Specify individual budget threshold (if --budget-path not set)
-s, --silent Run Lighthouse without printing report log
--report=<path> Generate an HTML report inside a specified folder
--filename=<filename> Specify the name of the generated HTML report file (requires --report)
-json, --jsonReport Generate JSON report in addition to HTML (requires --report)
--config-path The path to the Lighthouse config JSON (read more here: https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md)
--budget-path The path to the Lighthouse budgets config JSON (read more here: https://developers.google.com/web/tools/lighthouse/audits/budgets)
--score=<threshold> Specify a score threshold for the CI to pass
--performance=<threshold> Specify a minimal performance score for the CI to pass
--pwa=<threshold> Specify a minimal pwa score for the CI to pass
--accessibility=<threshold> Specify a minimal accessibility score for the CI to pass
--best-practice=<threshold> [DEPRECATED] Use best-practices instead
--best-practices=<threshold> Specify a minimal best-practice score for the CI to pass
--seo=<threshold> Specify a minimal seo score for the CI to pass
--fail-on-budgets Specify CI should fail if budgets are exceeded
--budget.<counts|sizes>.<type> Specify individual budget threshold (if --budget-path not set)
In addition to listed "lighthouse-ci" configuration flags, it is also possible to pass any native "lighthouse" flag
To see the full list of available flags, please refer to the official Google Lighthouse documentation at https://github.com/GoogleChrome/lighthouse#cli-options
Expand Down Expand Up @@ -105,8 +105,7 @@ const cli = meow(
default: false,
},
budget: {
type: 'object',
default: false,
type: 'string',
},
},
},
Expand Down Expand Up @@ -197,11 +196,7 @@ Promise.resolve()
continue;
}

console.log(
`${chalk.yellow(category)}: ${chalk.yellow(
categoryReport[category],
)}`,
);
console.log(`${chalk.yellow(category)}: ${chalk.yellow(categoryReport[category])}`);
}

for (const budget in budgetsReport) {
Expand All @@ -210,9 +205,7 @@ Promise.resolve()
}

if (budgetsReport[budget]) {
console.log(
`Budget '${chalk.yellow(budget)}' exceeded by ${chalk.yellow(budgetsReport[budget])}`,
);
console.log(`Budget '${chalk.yellow(budget)}' exceeded by ${chalk.yellow(budgetsReport[budget])}`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lighthouse-ci",
"version": "1.10.0",
"version": "1.10.1",
"description": "CLI implementation for running Lighthouse with any CI tool",
"scripts": {
"test": "npm run format && xo && jest",
Expand Down

0 comments on commit e3d7d1b

Please sign in to comment.