@@ -14,7 +14,7 @@ const projectDir = path.join(dirname, '../');
1414const reportsDir = path . join ( projectDir , 'dist/reports' ) ;
1515
1616// Constants
17- const AUDIT_CATEGORIES = [ 'accessibility' , 'best-practices' , 'performance' , 'pwa' , ' seo'] ;
17+ const AUDIT_CATEGORIES = [ 'accessibility' , 'best-practices' , 'performance' , 'seo' ] ;
1818
1919/**
2020 * @type {LH.Flags }
@@ -34,16 +34,16 @@ _main(process.argv.slice(2)).then(() => console.log('Audit completed.'));
3434/**
3535 * Usage:
3636 * ```sh
37- * node tools/lighthouse-audit < url> < min-scores> [< log-file> ]
37+ * node tools/lighthouse-audit {{ url}} {{ min-scores}} [{{ log-file}} ]
3838 * ```
3939 *
4040 * Runs audits against the specified URL on specific categories (accessibility,
4141 * best practices, performance, PWA, SEO). It fails, if the score in any
42- * category is below the score specified in `< min-scores> `. (Only runs audits
42+ * category is below the score specified in `{{ min-scores}} `. (Only runs audits
4343 * for the specified categories.)
4444 *
45- * `< min-scores> ` is either a number (in which case it is interpreted as
46- * `all:< min-score> `) or a list of comma-separated strings of the form
45+ * `{{ min-scores}} ` is either a number (in which case it is interpreted as
46+ * `all:{{ min-score}} `) or a list of comma-separated strings of the form
4747 * `key:value`, where `key` is one of `accessibility`, `best-practices`,
4848 * `performance`, `pwa`, `seo` or `all` and `value` is a number (between 0 and 100).
4949 *
@@ -55,15 +55,13 @@ _main(process.argv.slice(2)).then(() => console.log('Audit completed.'));
5555 * - `performance:90`: Only run audits for the `performance` category and require a score of 90
5656 * or higher.
5757 *
58- * If `< log-file> ` is defined, the full results will be logged there.
58+ * If `{{ log-file}} ` is defined, the full results will be logged there.
5959 *
6060 * Skips HTTPS-related audits, when run for an HTTP URL.
6161 *
6262 * Originally from https://github.com/angular/angular/blob/ab8199f7c909eaa8937d293ab44405fe263417cd/aio/scripts/audit-web-app.js
6363 *
64- * @param {string[] } args <url> <min-scores> [<log-file>]
65- * @returns {Promise<void> }
66- * @private
64+ * @param args {{url}} {{min-scores}} [{{log-file}}]
6765 */
6866async function _main ( args ) {
6967 const { url, minScores} = parseInput ( args ) ;
@@ -132,10 +130,10 @@ function formatScore(score) {
132130}
133131
134132/**
135- * @param { string } url the URL to run Lighthouse against
136- * @param { LH.Flags } flags Lighthouse flags
137- * @param { LH.Config.Json } config Lighthouse JSON config
138- * @returns { Promise<LH.RunnerResult | undefined> } the result of the Lighthouse run
133+ * @param url the URL to run Lighthouse against
134+ * @param flags Lighthouse flags
135+ * @param config Lighthouse JSON config
136+ * @returns the result of the Lighthouse run
139137 */
140138async function launchChromeAndRunLighthouse ( url , flags , config ) {
141139 const browser = await puppeteer . launch ( {
@@ -174,8 +172,6 @@ async function cleanupAndPrepareReportsDir() {
174172
175173/**
176174 * Parse CLI args and throw errors if any are invalid.
177- * @param {string[] } args <url> <min-scores> [<log-file>]
178- * @returns {{url: string, minScores: {all?: number, performance?: number, accessibility?: number, 'best-practices'?: number, pwa?: number, seo?: number}} }
179175 * the validated URL, parsed minimum scores, and optional file path to write the report to
180176 */
181177function parseInput ( args ) {
@@ -244,10 +240,10 @@ function parseMinScores(raw) {
244240}
245241
246242/**
247- * @param { LH.RunnerResult } results from a Lighthouse run
248- * @param { {all?: number, performance?: number, accessibility?: number, 'best-practices'?: number, pwa?: number, seo?: number} } minScores the minimum acceptable scores for each audit category
249- * @param { string= } logFile optional file path to write the report to
250- * @returns { Promise<boolean> } true if all of the scores were above the required min scores, false otherwise
243+ * @param results from a Lighthouse run
244+ * @param minScores the minimum acceptable scores for each audit category
245+ * @param logFile optional file path to write the report to
246+ * @returns true if all of the scores were above the required min scores, false otherwise
251247 */
252248async function processResults ( results , minScores , logFile ) {
253249 const lhVersion = results . lhr . lighthouseVersion ;
0 commit comments