Skip to content
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

extension: expose devtools hooks reliably #5579

Merged
merged 11 commits into from
Jun 29, 2018
5 changes: 1 addition & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ test_script:
- npm --version
- yarn --version
- which yarn
- yarn lint
- yarn unit
- yarn type-check
# FIXME: Exclude Appveyor from running `perf` smoketest until we fix the flake.
# https://github.com/GoogleChrome/lighthouse/issues/5053
# - yarn smoke
- yarn smoke ally pwa pwa2 pwa3 dbw redirects seo offline byte tti
- node lighthouse-cli/index.js https://www.chromestatus.com/ --config-path=lighthouse-cli/test/smokehouse/pwa-config.js --output-path=smokehouse-55623.report.json --output=json --port=0

cache:
#- chrome-win32 -> appveyor.yml,package.json
Expand Down
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ before_script:
- yarn build-all
script:
- yarn bundlesize
- yarn lint
- yarn unit:silentcoverage
- yarn type-check
- yarn diff:sample-json
- yarn smoke:silentcoverage
- yarn test-extension
- yarn test-viewer
- yarn test-lantern
- node lighthouse-cli/index.js https://www.chromestatus.com/ --config-path=lighthouse-cli/test/smokehouse/pwa-config.js --output-path=smokehouse-55623.report.json --output=json --port=0
# _JAVA_OPTIONS is breaking parsing of compiler output. See #3338.
- unset _JAVA_OPTIONS
# FIXME(paulirish): re-enable after a roll of LH->CDT
Expand Down
55 changes: 0 additions & 55 deletions lighthouse-cli/test/smokehouse/pwa-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,62 +22,7 @@ const pwaDetailsExpectations = {
* results.
*/
module.exports = [
{
requestedUrl: 'https://airhorner.com',
finalUrl: 'https://airhorner.com/',
audits: {
'is-on-https': {
score: 1,
},
'redirects-http': {
score: 1,
},
'service-worker': {
score: 1,
},
'works-offline': {
score: 1,
},
'viewport': {
score: 1,
},
'without-javascript': {
score: 1,
},
'load-fast-enough-for-pwa': {
// Ignore speed test; just verify that it ran.
},
'webapp-install-banner': {
score: 1,
details: {items: [pwaDetailsExpectations]},
},
'splash-screen': {
score: 1,
details: {items: [pwaDetailsExpectations]},
},
'themed-omnibox': {
score: 1,
details: {items: [{...pwaDetailsExpectations, themeColor: '#2196F3'}]},
},
'content-width': {
score: 1,
},

// "manual" audits. Just verify in the results.
'pwa-cross-browser': {
score: null,
scoreDisplayMode: 'manual',
},
'pwa-page-transitions': {
score: null,
scoreDisplayMode: 'manual',
},
'pwa-each-page-has-url': {
score: null,
scoreDisplayMode: 'manual',
},
},
},

{
requestedUrl: 'https://www.chromestatus.com/',
Expand Down
8 changes: 3 additions & 5 deletions lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function runLighthouse(url, configPath, isDebug) {
`--config-path=${configPath}`,
`--output-path=${outputPath}`,
'--output=json',
'--quiet',
'--port=0',
];

Expand Down Expand Up @@ -93,10 +92,9 @@ function runLighthouse(url, configPath, isDebug) {
process.exit(runResults.status);
}

if (isDebug) {
console.log(`STDOUT: ${runResults.stdout}`);
console.error(`STDERR: ${runResults.stderr}`);
}

console.log(`STDOUT: ${runResults.stdout}`);
console.error(`STDERR: ${runResults.stderr}`);

const lhr = fs.readFileSync(outputPath, 'utf8');
if (isDebug) {
Expand Down
6 changes: 4 additions & 2 deletions lighthouse-extension/app/src/lighthouse-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ if (typeof module !== 'undefined' && module.exports) {
getDefaultCategories,
listenForStatus,
};
} else {
// If not require()d, expose on window for devtools, other consumers of file.
}

if (window) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof window !== 'undefined' maybe? :)

// Expose on window for devtools, other consumers of file.
// @ts-ignore
window.runLighthouseInWorker = runLighthouseInWorker;
// @ts-ignore
Expand Down