Skip to content

Commit

Permalink
pass --enable-extensions on from manual-chrome-launcher (#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny authored and paulirish committed Jul 25, 2017
1 parent 15068bd commit 37fd38c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chrome-launcher/manual-chrome-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
*
* Assuming Lighthouse is installed globally or `npm link`ed, use via:
* chrome-debug
* Optionally pass additional a port, chrome flags and/or a URL
* Optionally enable extensions or pass a port, additional chrome flags, and/or a URL
* chrome-debug --port=9222
* chrome-debug http://goat.com
* chrome-debug --show-paint-rects
* chrome-debug --enable-extensions
*/

require('./compiled-check.js')('chrome-launcher.js');
Expand All @@ -19,18 +20,22 @@ const args = process.argv.slice(2);
let chromeFlags;
let startingUrl;
let port;
let enableExtensions;

if (args.length) {
chromeFlags = args.filter(flag => flag.startsWith('--'));

const portFlag = chromeFlags.find(flag => flag.startsWith('--port='));
port = portFlag && portFlag.replace('--port=', '');

enableExtensions = !!chromeFlags.find(flag => flag === '--enable-extensions');

startingUrl = args.find(flag => !flag.startsWith('--'));
}

launch({
startingUrl,
port,
enableExtensions,
chromeFlags,
}).then(v => console.log(`✨ Chrome debugging port: ${v.port}`));

0 comments on commit 37fd38c

Please sign in to comment.