Skip to content

Commit

Permalink
cli: only launch Chrome when running against localhost (#12140)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkindy authored Mar 3, 2021
1 parent c6d9fc0 commit 18eacb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lighthouse-cli/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const lighthouse = require('../lighthouse-core/index.js');
const log = require('lighthouse-logger');
const getFilenamePrefix = require('../lighthouse-core/lib/file-namer.js').getFilenamePrefix;
const assetSaver = require('../lighthouse-core/lib/asset-saver.js');
const URL = require('../lighthouse-core/lib/url-shim.js');

const open = require('open');

Expand Down Expand Up @@ -216,7 +217,8 @@ async function runLighthouse(url, flags, config) {

try {
const shouldGather = flags.gatherMode || flags.gatherMode === flags.auditMode;
if (shouldGather) {
const shouldUseLocalChrome = URL.isLikeLocalhost(flags.hostname);
if (shouldGather && shouldUseLocalChrome) {
launchedChrome = await getDebuggableChrome(flags);
flags.port = launchedChrome.port;
}
Expand Down

0 comments on commit 18eacb9

Please sign in to comment.