-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(lantern): more flexible graph edge creation #4933
Changes from 1 commit
3e9f29a
1c1dec1
d76cf19
bbc64ba
cc18bfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
/* eslint-disable no-console */ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const spawnSync = require('child_process').spawnSync; | ||
const yargs = require('yargs'); | ||
|
@@ -43,19 +44,30 @@ function resolveLocalOrCwd(payloadPath) { | |
* Launch Chrome and do a full Lighthouse run. | ||
* @param {string} url | ||
* @param {string} configPath | ||
* @param {boolean=} isDebug | ||
* @return {!LighthouseResults} | ||
*/ | ||
function runLighthouse(url, configPath) { | ||
function runLighthouse(url, configPath, isDebug) { | ||
const command = 'node'; | ||
const args = [ | ||
'lighthouse-cli/index.js', | ||
url, | ||
`--config-path=${configPath}`, | ||
`--output-path=smokehouse.report.json`, | ||
'--output=json', | ||
'--quiet', | ||
'--port=0', | ||
]; | ||
|
||
if (isDebug || process.env.SMOKEHOUSE_DEBUG) { | ||
args.push('-GA'); | ||
} | ||
|
||
if (process.env.APPVEYOR) { | ||
// Appveyor is hella slow already, disable CPU throttling so we're not 16x slowdown | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe link to #4891? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 done |
||
args.push('--disable-cpu-throttling'); | ||
} | ||
|
||
// Lighthouse sometimes times out waiting to for a connection to Chrome in CI. | ||
// Watch for this error and retry relaunching Chrome and running Lighthouse up | ||
// to RETRIES times. See https://github.com/GoogleChrome/lighthouse/issues/833 | ||
|
@@ -80,7 +92,12 @@ function runLighthouse(url, configPath) { | |
process.exit(runResults.status); | ||
} | ||
|
||
return JSON.parse(runResults.stdout); | ||
if (isDebug || process.env.SMOKEHOUSE_DEBUG) { | ||
console.log(`STDOUT: ${runResults.stdout}`); | ||
console.error(`STDERR: ${runResults.stderr}`); | ||
} | ||
|
||
return JSON.parse(fs.readFileSync('smokehouse.report.json', 'utf8')); | ||
} | ||
|
||
/** | ||
|
@@ -275,6 +292,7 @@ const cli = yargs | |
.describe({ | ||
'config-path': 'The path to the config JSON file', | ||
'expectations-path': 'The path to the expected audit results file', | ||
'debug': 'Save the artifacts along with the output', | ||
}) | ||
.default('config-path', DEFAULT_CONFIG_PATH) | ||
.default('expectations-path', DEFAULT_EXPECTATIONS_PATH) | ||
|
@@ -289,7 +307,7 @@ let passingCount = 0; | |
let failingCount = 0; | ||
expectations.forEach(expected => { | ||
console.log(`Checking '${expected.initialUrl}'...`); | ||
const results = runLighthouse(expected.initialUrl, configPath); | ||
const results = runLighthouse(expected.initialUrl, configPath, cli.debug); | ||
const collated = collateResults(results, expected); | ||
const counts = report(collated); | ||
passingCount += counts.passed; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I often run
yarn smokehouse
andyarn smoke
simultaneously which could conflict in this scenario.also my smokehouse revamp PR means we'll have a lot of these running at the same time.
how about something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we go down this path, can we delete the report by default then? :P