diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index e9e0decff3d1..000000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,51 +0,0 @@ -clone_depth: 10 - -version: "{build}" - -branches: - only: - - master - -image: Visual Studio 2019 -environment: - fast_finish: true - matrix: - - nodejs_version: "10" - platform: x86 - -build: off - -install: - - ps: Install-Product node $env:nodejs_version $env:platform - - npm install yarn -g - - yarn - -before_test: - - set "PATH=C:\MinGW\msys\1.0\bin;%PATH%" - - yarn build-all - -test_script: - - node --version - - npm --version - - yarn --version - - which yarn - - yarn lint - - yarn unit-core --runInBand - # Appveyor protocol timeouts are unusually common. - # We retry our smoketests 3 times for this reason, so do the same for CLI tests that launch Chrome. - - yarn unit-cli || yarn unit-cli || yarn unit-cli - - yarn unit-viewer - - yarn type-check - # run smoke tests serially, trying up to three times to prevent flakes. - # FIXME: Exclude Appveyor from running `lantern` smoketest until we fix the flake. - - yarn smoke -j=1 --retries=2 a11y errors oopif pwa pwa2 pwa3 dbw redirects seo offline byte perf metrics - -on_success: - # Remove module resolution symlinks; this avoids 'Unable to save cache' - # errors when appveyor runs 7z.exe to save the build cache - - yarn unlink lighthouse - - yarn unlink - -cache: - - node_modules -> appveyor.yml,package.json,yarn.lock - - '%LOCALAPPDATA%\Yarn -> appveyor.yml,package.json,yarn.lock' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14d44315a2f8..c77b7eb994fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,8 @@ jobs: run: xvfb-run --auto-servernum yarn test-bundle - name: yarn test-docs run: xvfb-run --auto-servernum yarn test-docs + - name: yarn test-viewer + run: xvfb-run --auto-servernum yarn test-viewer - run: yarn diff:sample-json - run: yarn type-check diff --git a/.gitignore b/.gitignore index 49faa9e06801..76ab28a40e69 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ npm-debug.log .vscode .tmp .idea +.tmp_env /dist coverage diff --git a/.npmignore b/.npmignore index 16eb5f901279..32f4dcd3806e 100644 --- a/.npmignore +++ b/.npmignore @@ -47,7 +47,6 @@ results.html *.lcov # dev files -.appveyor.yml .DS_Store .editorconfig .eslintignore diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..17b889cdc33b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,93 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *Brendan Kenny (bckenny@google.com)*, the +Project Steward(s) for *Lighthouse*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/build/build-bundle.js b/build/build-bundle.js index 077845fecf25..7b4b4ccf715a 100644 --- a/build/build-bundle.js +++ b/build/build-bundle.js @@ -35,7 +35,7 @@ const locales = fs.readdirSync(__dirname + '/../lighthouse-core/lib/i18n/locales // HACK: manually include the lighthouse-plugin-publisher-ads audits. /** @type {Array} */ -// @ts-ignore +// @ts-expect-error const pubAdsAudits = require('lighthouse-plugin-publisher-ads/plugin.js').audits.map(a => a.path); /** @param {string} file */ @@ -84,7 +84,7 @@ async function browserifyFile(entryPath, distPath) { // Don't include locales in DevTools. if (isDevtools(entryPath)) { - // @ts-ignore bundle.ignore does accept an array of strings. + // @ts-expect-error bundle.ignore does accept an array of strings. bundle.ignore(locales); } @@ -171,7 +171,7 @@ async function cli(argv) { build(entryPath, distPath); } -// @ts-ignore Test if called from the CLI or as a module. +// @ts-expect-error Test if called from the CLI or as a module. if (require.main === module) { cli(process.argv); } else { diff --git a/build/changelog-generator/index.js b/build/changelog-generator/index.js index b39221d4ed14..efc2acd85e9b 100644 --- a/build/changelog-generator/index.js +++ b/build/changelog-generator/index.js @@ -32,8 +32,8 @@ const titlePrecedence = [ 'New Audits', 'Core', 'CLI', - 'Deps', 'Report', + 'Deps', 'Clients', 'I18n', 'Docs', diff --git a/changelog.md b/changelog.md index c0bf9fab36a0..2ed45f5d9435 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,138 @@ + +# 6.2.0 (2020-08-06) +[Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v6.1.1...v6.2.0) + +We expect this release to ship in the DevTools of [Chrome 86](https://chromiumdash.appspot.com/schedule), and to PageSpeed +Insights within 2 weeks. + +## New Contributors + +Thanks to our new contributors 👽🐷🐰🐯🐻! + +* Adam Raine @adamraine +* Saavan Nanavati @saavannanavati +* lemcardenas @lemcardenas +* George Makunde Martin @gMakunde +* David Gilman @dgilman +* Emilio Garza @emiliogarza +* LukasAuerMstage @LukasAuerMstage +* Mustafa Aydemir @mstfydmr +* Pramod Mali @malipramod +* Robin Tom @robintom +* Stacey Tay @staceytay +* Wojciech Maj @wojtekmaj +* moli @phpmoli +* Муравьёв Семён @Zulcom + +## New Audits + +* move duplicated-javascript and legacy-javascript audits to default config ([#10881](https://github.com/GoogleChrome/lighthouse/pull/10881), [#11103](https://github.com/GoogleChrome/lighthouse/pull/11103)) +* report animations not run on compositor ([#11138](https://github.com/GoogleChrome/lighthouse/pull/11138), [#11168](https://github.com/GoogleChrome/lighthouse/pull/11168), [#11105](https://github.com/GoogleChrome/lighthouse/pull/11105)) +* add unsized-images audit ([#11188](https://github.com/GoogleChrome/lighthouse/pull/11188), [#11115](https://github.com/GoogleChrome/lighthouse/pull/11115), [#11217](https://github.com/GoogleChrome/lighthouse/pull/11217)) +* add no-unload-listeners audit ([#11085](https://github.com/GoogleChrome/lighthouse/pull/11085)) + +## Core + +* uses-http2: convert into opportunity ([#10626](https://github.com/GoogleChrome/lighthouse/pull/10626)) +* lantern: fallback to FCP in 0-weight SI situations ([#11174](https://github.com/GoogleChrome/lighthouse/pull/11174)) +* stacks: timeout stack detection ([#11172](https://github.com/GoogleChrome/lighthouse/pull/11172)) +* add FormElements gatherer ([#11062](https://github.com/GoogleChrome/lighthouse/pull/11062)) +* cls: add back early shift events if they were ignored ([#11079](https://github.com/GoogleChrome/lighthouse/pull/11079)) +* critical-request-chains: prune requests without an initiator ([#11151](https://github.com/GoogleChrome/lighthouse/pull/11151)) +* error if chrome version does not support lcp metric ([#11016](https://github.com/GoogleChrome/lighthouse/pull/11016)) +* font-display: dedupe warnings by font origin ([#11068](https://github.com/GoogleChrome/lighthouse/pull/11068)) +* gather-runner: error on non-HTML ([#11042](https://github.com/GoogleChrome/lighthouse/pull/11042)) +* hreflang: assert that the href is fully qualified ([#11022](https://github.com/GoogleChrome/lighthouse/pull/11022)) +* image-elements: gather correct natural size for srcset ([#11101](https://github.com/GoogleChrome/lighthouse/pull/11101)) +* is-on-https: add mixed-content resolution ([#10975](https://github.com/GoogleChrome/lighthouse/pull/10975)) +* lantern: ignore circular initiators ([#11148](https://github.com/GoogleChrome/lighthouse/pull/11148)) +* link-elements: add devtoolsNodePath ([#11061](https://github.com/GoogleChrome/lighthouse/pull/11061)) +* link-text: removing inicio from blocklist resolves #11026 ([#11073](https://github.com/GoogleChrome/lighthouse/pull/11073)) +* page-functions: expose simulated throttling requestIdleCallback shim ([#11032](https://github.com/GoogleChrome/lighthouse/pull/11032)) +* redirects: surface client-side redirects ([#11027](https://github.com/GoogleChrome/lighthouse/pull/11027)) +* tracehouse: expose navigationStart only as timeOrigin ([#11034](https://github.com/GoogleChrome/lighthouse/pull/11034)) +* add cap to amp stylesheet links for simulated throttling ([#11069](https://github.com/GoogleChrome/lighthouse/pull/11069)) +* remove uses of deprecated extendedInfo field ([#10779](https://github.com/GoogleChrome/lighthouse/pull/10779)) +* config: remove typo in a11y tables lists group ([#11099](https://github.com/GoogleChrome/lighthouse/pull/11099)) + +## CLI + +* clearTimeout for faster exit ([#11170](https://github.com/GoogleChrome/lighthouse/pull/11170)) +* warn if Chrome died on its own instead of exit ([#11139](https://github.com/GoogleChrome/lighthouse/pull/11139)) + +## Report + +* correctly display CLS in budget table ([#11209](https://github.com/GoogleChrome/lighthouse/pull/11209)) +* add full-page-screenshot to experimental config ([#10716](https://github.com/GoogleChrome/lighthouse/pull/10716)) +* vertically center thumbnails ([#11220](https://github.com/GoogleChrome/lighthouse/pull/11220)) +* truncate long attribute values in HTML snippets ([#10984](https://github.com/GoogleChrome/lighthouse/pull/10984)) +* unused-javascript: update "learn more" link ([#10985](https://github.com/GoogleChrome/lighthouse/pull/10985)) + +## Deps + +* snyk: update script to prune <0.0.0 and update snapshot ([#11223](https://github.com/GoogleChrome/lighthouse/pull/11223)) +* snyk: update snyk snapshot ([#11046](https://github.com/GoogleChrome/lighthouse/pull/11046)) +* update dot-prop secondary dependency ([#11198](https://github.com/GoogleChrome/lighthouse/pull/11198)) +* update jpeg-js to 0.4.x ([#11167](https://github.com/GoogleChrome/lighthouse/pull/11167)) +* update third-party-web ([#11137](https://github.com/GoogleChrome/lighthouse/pull/11137)) + +## I18n + +* import strings ([#11082](https://github.com/GoogleChrome/lighthouse/pull/11082), [#11225](https://github.com/GoogleChrome/lighthouse/pull/11225)) +* disallow invalid text outside complex ICU arguments ([#11135](https://github.com/GoogleChrome/lighthouse/pull/11135)) +* update AMP Optimizer URLs ([#11088](https://github.com/GoogleChrome/lighthouse/pull/11088)) +* log the percentage of translated messages ([#11149](https://github.com/GoogleChrome/lighthouse/pull/11149)) + +## Docs + +* configuration: updates and tweaks ([#11141](https://github.com/GoogleChrome/lighthouse/pull/11141)) +* update architecture.md ([#11040](https://github.com/GoogleChrome/lighthouse/pull/11040), [#11089](https://github.com/GoogleChrome/lighthouse/pull/11089)) +* readme: add Screpy to list of integrations ([#11126](https://github.com/GoogleChrome/lighthouse/pull/11126)) +* readme: fix logging in programmatic use code example ([#11116](https://github.com/GoogleChrome/lighthouse/pull/11116)) +* update devtools screenshot ([#11092](https://github.com/GoogleChrome/lighthouse/pull/11092)) +* fix typo in viewer readme for loading json from url ([#11080](https://github.com/GoogleChrome/lighthouse/pull/11080)) +* readme: update Foo integration ([#11050](https://github.com/GoogleChrome/lighthouse/pull/11050)) + +## Tests + +* istanbul ignore inpage function ([#11229](https://github.com/GoogleChrome/lighthouse/pull/11229)) +* update chromestatus expecatations ([#11221](https://github.com/GoogleChrome/lighthouse/pull/11221)) +* minification-est: add testcase with pre-minified bundle ([#11191](https://github.com/GoogleChrome/lighthouse/pull/11191)) +* update to typescript 3.9.7 ([#11158](https://github.com/GoogleChrome/lighthouse/pull/11158)) +* smoke: skip expectation with _chromeMajorVersion ([#10976](https://github.com/GoogleChrome/lighthouse/pull/10976)) +* smoke: use caltrainschedule instead of polymer shop ([#11052](https://github.com/GoogleChrome/lighthouse/pull/11052)) +* relax requestIdleCallback smoke expectation ([#11041](https://github.com/GoogleChrome/lighthouse/pull/11041)) +* parallelize all the tests ([#11009](https://github.com/GoogleChrome/lighthouse/pull/11009)) +* upgrade codecov to 3.7.0 ([#11039](https://github.com/GoogleChrome/lighthouse/pull/11039)) +* update minor version of angular fixture redux ([#11192](https://github.com/GoogleChrome/lighthouse/pull/11192)) +* run GitHub Actions on master and PRs ([#11035](https://github.com/GoogleChrome/lighthouse/pull/11035)) +* run test-viewer in github actions ([#11195](https://github.com/GoogleChrome/lighthouse/pull/11195)) +* add windows to GitHub actions CI ([#11087](https://github.com/GoogleChrome/lighthouse/pull/11087)) +* use latest windows image on appveyor ([#11083](https://github.com/GoogleChrome/lighthouse/pull/11083)) +* remove appveyor ([#11171](https://github.com/GoogleChrome/lighthouse/pull/11171)) + +## Misc + +* remove last extendedInfo in LH.Audit.Product ([#11067](https://github.com/GoogleChrome/lighthouse/pull/11067)) +* add GCP collection scripts ([#11189](https://github.com/GoogleChrome/lighthouse/pull/11189)) +* tighten RecursivePartial type ([#11175](https://github.com/GoogleChrome/lighthouse/pull/11175)) +* release: tweaks ([#11021](https://github.com/GoogleChrome/lighthouse/pull/11021)) +* compare-runs: fix error when no lh-flags arg passed ([#11015](https://github.com/GoogleChrome/lighthouse/pull/11015)) +* annotate version-specific logic with COMPAT comments ([#11019](https://github.com/GoogleChrome/lighthouse/pull/11019)) +* add tools to track issue response time ([#11020](https://github.com/GoogleChrome/lighthouse/pull/11020)) +* tweak naming in element-screenshot renderer ([#11152](https://github.com/GoogleChrome/lighthouse/pull/11152)) +* ignore coverage of page-functions ([#11136](https://github.com/GoogleChrome/lighthouse/pull/11136)) + + +# 6.1.1 (2020-07-07) +[Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v6.1.0...v6.1.1) + +This is a patch release to fix an issue that only occurred in 6.1.0 for Node environments. It will only be released to npm. + +## Core + +* fetcher: ensure fetch doesn't cause unhandled promise ([#11036](https://github.com/GoogleChrome/lighthouse/pull/11036)) + # 6.1.0 (2020-06-25) [Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v6.0.0...v6.1.0) diff --git a/clients/devtools-entry.js b/clients/devtools-entry.js index d7d1fcf7a09b..0b434bcfe522 100644 --- a/clients/devtools-entry.js +++ b/clients/devtools-entry.js @@ -59,26 +59,25 @@ if (typeof module !== 'undefined' && module.exports) { // work for LH because of https://github.com/browserify/browserify/issues/968 // Instead, since this file is only ever run in node for testing, expose a // bundle entry point as global. - // @ts-ignore + // @ts-expect-error global.runBundledLighthouse = lighthouse; } // Expose only in DevTools' worker -// @ts-ignore if (typeof self !== 'undefined') { // TODO: refactor and delete `global.isDevtools`. global.isDevtools = true; - // @ts-ignore + // @ts-expect-error self.setUpWorkerConnection = setUpWorkerConnection; - // @ts-ignore + // @ts-expect-error self.runLighthouse = lighthouse; - // @ts-ignore + // @ts-expect-error self.createConfig = createConfig; - // @ts-ignore + // @ts-expect-error self.listenForStatus = listenForStatus; - // @ts-ignore + // @ts-expect-error self.registerLocaleData = registerLocaleData; - // @ts-ignore + // @ts-expect-error self.lookupLocale = lookupLocale; } diff --git a/clients/devtools-report-assets.js b/clients/devtools-report-assets.js index 44db94c8a3bc..1eb95904e6ac 100644 --- a/clients/devtools-report-assets.js +++ b/clients/devtools-report-assets.js @@ -13,7 +13,7 @@ /* global Runtime */ -// @ts-ignore: Runtime.cachedResources exists in Devtools. https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/front_end/root/Runtime.js;l=1169 +// @ts-expect-error: Runtime.cachedResources exists in Devtools. https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/front_end/root/Runtime.js;l=1169 const cachedResources = Runtime.cachedResources; // Getters are necessary because the DevTools bundling processes diff --git a/clients/lightrider/lightrider-entry.js b/clients/lightrider/lightrider-entry.js index 91c74e9e157b..9778337533f5 100644 --- a/clients/lightrider/lightrider-entry.js +++ b/clients/lightrider/lightrider-entry.js @@ -101,6 +101,6 @@ if (typeof module !== 'undefined' && module.exports) { // Expose on window for browser-residing consumers of file. if (typeof window !== 'undefined') { - // @ts-ignore + // @ts-expect-error - not worth typing a property on `window`. window.runLighthouseInLR = runLighthouseInLR; } diff --git a/docs/configuration.md b/docs/configuration.md index cc55976920e3..ccee8c643375 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -8,7 +8,7 @@ Read more about the [architecture of Lighthouse](./architecture.md). You can specify a custom config file when using Lighthouse through the CLI or consuming the npm module yourself. -**custom-config.js** +**custom-config.js file** ```js module.exports = { extends: 'lighthouse:default', @@ -23,12 +23,12 @@ module.exports = { }; ``` -**CLI** +**Use config file via CLI** ```sh lighthouse --config-path=path/to/custom-config.js https://example.com ``` -**Node** +**Use config file via Node** ```js const lighthouse = require('lighthouse'); const config = require('./path/to/custom-config.js'); @@ -72,7 +72,7 @@ The settings property controls various aspects of running Lighthouse such as CPU ``` #### Options -For full list see [our default config settings](https://github.com/GoogleChrome/lighthouse/blob/8f500e00243e07ef0a80b39334bedcc8ddc8d3d0/lighthouse-core/config/constants.js#L30-L48). +For full list see [our config settings typedef](https://github.com/GoogleChrome/lighthouse/blob/575e29b8b6634bfb280bc820efea6795f3dd9017/types/externs.d.ts#L141-L186). | Name | Type | Description | | -- | -- | -- | @@ -213,4 +213,3 @@ The best examples are the ones Lighthouse uses itself! There are several referen * [lighthouse-core/config/perf-config.js](https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/config/perf-config.js) * [docs/recipes/custom-audit/custom-config.js](https://github.com/GoogleChrome/lighthouse/blob/master/docs/recipes/custom-audit/custom-config.js) * [pwmetrics](https://github.com/paulirish/pwmetrics/blob/v4.1.1/lib/perf-config.ts) - diff --git a/docs/plugins.md b/docs/plugins.md index 26f45670f214..38b970661d0c 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -60,10 +60,10 @@ A Lighthouse plugin is just a node module with a name that starts with `lighthou "name": "lighthouse-plugin-cats", "main": "plugin.js", "peerDependencies": { - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" }, "devDependencies": { - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" } } ``` diff --git a/docs/recipes/custom-audit/package.json b/docs/recipes/custom-audit/package.json index 2dc2663f2962..57418ecf37c1 100644 --- a/docs/recipes/custom-audit/package.json +++ b/docs/recipes/custom-audit/package.json @@ -3,6 +3,6 @@ "private": true, "scripts": {}, "devDependencies": { - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" } } diff --git a/docs/recipes/gulp/package.json b/docs/recipes/gulp/package.json index 1a155385361c..835a759029d1 100644 --- a/docs/recipes/gulp/package.json +++ b/docs/recipes/gulp/package.json @@ -7,6 +7,6 @@ "devDependencies": { "gulp": "^3.9.1", "gulp-connect": "^5.0.0", - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" } } diff --git a/docs/recipes/lighthouse-plugin-example/package.json b/docs/recipes/lighthouse-plugin-example/package.json index c1f64fa94694..5e4bc5424191 100644 --- a/docs/recipes/lighthouse-plugin-example/package.json +++ b/docs/recipes/lighthouse-plugin-example/package.json @@ -3,9 +3,9 @@ "private": true, "main": "./plugin.js", "peerDependencies": { - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" }, "devDependencies": { - "lighthouse": "^6.1.0" + "lighthouse": "^6.2.0" } } diff --git a/docs/releasing.md b/docs/releasing.md index 98bdc6466411..2e67fe0cebbe 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -127,7 +127,7 @@ bash ./lighthouse-core/scripts/release/prepare-package.sh # Make sure you're in the Lighthouse pristine repo we just tested. cd ../lighthouse-pristine -# Sanity check: last chance to abort. +# Last chance to abort. git status git log diff --git a/lighthouse-cli/bin.js b/lighthouse-cli/bin.js index f7b250c88a75..76d3b77ac634 100644 --- a/lighthouse-cli/bin.js +++ b/lighthouse-cli/bin.js @@ -96,7 +96,7 @@ async function begin() { cliFlags.outputPath = 'stdout'; } - // @ts-ignore - deprecation message for removed disableDeviceEmulation; can remove warning in v6. + // @ts-expect-error - deprecation message for removed disableDeviceEmulation; can remove warning in v6. if (cliFlags.disableDeviceEmulation) { log.warn('config', 'The "--disable-device-emulation" has been removed in v5.' + ' Please use "--emulated-form-factor=none" instead.'); @@ -107,8 +107,8 @@ async function begin() { // copied over to LH.Settings.extraHeaders, which is LH.Crdp.Network.Headers. Force // the conversion here, but long term either the CLI flag or the setting should have // a different name. - // @ts-ignore - let extraHeadersStr = /** @type {string} */ (cliFlags.extraHeaders); + /** @type {string} */ + let extraHeadersStr = cliFlags.extraHeaders; // If not a JSON object, assume it's a path to a JSON file. if (extraHeadersStr.substr(0, 1) !== '{') { extraHeadersStr = fs.readFileSync(extraHeadersStr, 'utf-8'); diff --git a/lighthouse-cli/cli-flags.js b/lighthouse-cli/cli-flags.js index d7612001890f..e131126429b4 100644 --- a/lighthouse-cli/cli-flags.js +++ b/lighthouse-cli/cli-flags.js @@ -27,7 +27,7 @@ function flatten(arr) { * @return {LH.CliFlags} */ function getFlags(manualArgv) { - // @ts-ignore yargs() is incorrectly typed as not accepting a single string. + // @ts-expect-error yargs() is incorrectly typed as not accepting a single string. const y = manualArgv ? yargs(manualArgv) : yargs; // Intentionally left as type `any` because @types/yargs doesn't chain correctly. const argv = y.help('help') diff --git a/lighthouse-cli/run.js b/lighthouse-cli/run.js index ec28e7025b5a..efeb1cf2f564 100644 --- a/lighthouse-cli/run.js +++ b/lighthouse-cli/run.js @@ -8,6 +8,7 @@ /* eslint-disable no-console */ const path = require('path'); +const psList = require('ps-list'); const Printer = require('./printer.js'); const ChromeLauncher = require('chrome-launcher'); @@ -171,11 +172,25 @@ async function saveResults(runnerResult, flags) { async function potentiallyKillChrome(launchedChrome) { if (!launchedChrome) return; + /** @type {NodeJS.Timeout} */ + let timeout; + const timeoutPromise = new Promise((_, reject) => { + timeout = setTimeout(() => reject(new Error('Timed out waiting to kill Chrome')), 5000); + }); + return Promise.race([ launchedChrome.kill(), - new Promise((_, reject) => setTimeout(reject, 5000, 'Timed out.')), - ]).catch(err => { + timeoutPromise, + ]).catch(async err => { + const runningProcesses = await psList(); + if (!runningProcesses.some(proc => proc.pid === launchedChrome.pid)) { + log.warn('CLI', 'Warning: Chrome process could not be killed because it already exited.'); + return; + } + throw new Error(`Couldn't quit Chrome process. ${err}`); + }).finally(() => { + clearTimeout(timeout); }); } diff --git a/lighthouse-cli/sentry-prompt.js b/lighthouse-cli/sentry-prompt.js index f20ac2f24b59..131e8f80bad4 100644 --- a/lighthouse-cli/sentry-prompt.js +++ b/lighthouse-cli/sentry-prompt.js @@ -40,7 +40,7 @@ function prompt() { const timeoutPromise = new Promise((resolve) => { timeout = setTimeout(() => { - // @ts-ignore Promise returned by prompt is decorated with `ui` + // @ts-expect-error Promise returned by prompt is decorated with `ui` prompt.ui.close(); process.stdout.write('\n'); log.warn('CLI', 'No response to error logging preference, errors will not be reported.'); diff --git a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap index e9adc1148392..e626c54d11d0 100644 --- a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap +++ b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap @@ -162,6 +162,12 @@ Object { Object { "path": "no-unload-listeners", }, + Object { + "path": "non-composited-animations", + }, + Object { + "path": "unsized-images", + }, Object { "path": "manual/pwa-cross-browser", }, @@ -896,6 +902,11 @@ Object { "id": "uses-rel-preload", "weight": 0, }, + Object { + "group": "load-opportunities", + "id": "uses-http2", + "weight": 0, + }, Object { "group": "load-opportunities", "id": "efficient-animated-content", @@ -983,22 +994,27 @@ Object { }, Object { "group": "diagnostics", - "id": "uses-http2", + "id": "uses-passive-event-listeners", "weight": 0, }, Object { "group": "diagnostics", - "id": "uses-passive-event-listeners", + "id": "no-document-write", "weight": 0, }, Object { "group": "diagnostics", - "id": "no-document-write", + "id": "long-tasks", "weight": 0, }, Object { "group": "diagnostics", - "id": "long-tasks", + "id": "non-composited-animations", + "weight": 0, + }, + Object { + "group": "diagnostics", + "id": "unsized-images", "weight": 0, }, Object { @@ -1328,6 +1344,9 @@ Object { Object { "path": "iframe-elements", }, + Object { + "path": "form-elements", + }, Object { "path": "main-document-content", }, diff --git a/lighthouse-cli/test/cli/bin-test.js b/lighthouse-cli/test/cli/bin-test.js index fb58b047e906..2f134bec6534 100644 --- a/lighthouse-cli/test/cli/bin-test.js +++ b/lighthouse-cli/test/cli/bin-test.js @@ -147,7 +147,7 @@ describe('CLI bin', function() { describe('extraHeaders', () => { it('should convert extra headers to object', async () => { - // @ts-ignore - see TODO: in bin.js + // @ts-expect-error - see TODO: in bin.js cliFlags = {...cliFlags, extraHeaders: '{"foo": "bar"}'}; await bin.begin(); @@ -156,7 +156,7 @@ describe('CLI bin', function() { it('should read extra headers from file', async () => { const headersFile = require.resolve('../fixtures/extra-headers/valid.json'); - // @ts-ignore - see TODO: in bin.js + // @ts-expect-error - see TODO: in bin.js cliFlags = {...cliFlags, extraHeaders: headersFile}; await bin.begin(); diff --git a/lighthouse-cli/test/cli/cli-flags-test.js b/lighthouse-cli/test/cli/cli-flags-test.js index df190bf1450c..70c9ae7235e5 100644 --- a/lighthouse-cli/test/cli/cli-flags-test.js +++ b/lighthouse-cli/test/cli/cli-flags-test.js @@ -14,14 +14,14 @@ describe('CLI bin', function() { getFlags('chrome://version'); const yargs = require('yargs'); - // @ts-ignore - getGroups is private + // @ts-expect-error - getGroups is private const optionGroups = yargs.getGroups(); /** @type {string[]} */ const allOptions = []; Object.keys(optionGroups).forEach(key => { allOptions.push(...optionGroups[key]); }); - // @ts-ignore - getUsageInstance is private + // @ts-expect-error - getUsageInstance is private const optionsWithDescriptions = Object.keys(yargs.getUsageInstance().getDescriptions()); allOptions.forEach(opt => { diff --git a/lighthouse-cli/test/fixtures/byte-efficiency/tester.html b/lighthouse-cli/test/fixtures/byte-efficiency/tester.html index bacbd14215e4..d3016c908af0 100644 --- a/lighthouse-cli/test/fixtures/byte-efficiency/tester.html +++ b/lighthouse-cli/test/fixtures/byte-efficiency/tester.html @@ -76,6 +76,7 @@

Byte efficiency tester page

+ @@ -90,6 +91,7 @@

Byte efficiency tester page

+ @@ -97,6 +99,7 @@

Byte efficiency tester page

+ @@ -104,20 +107,39 @@

Byte efficiency tester page

+ + + + + + + + + + + + + + + + + + + @@ -125,6 +147,7 @@

Byte efficiency tester page

+ @@ -136,6 +159,7 @@

Byte efficiency tester page

+ @@ -143,6 +167,7 @@

Byte efficiency tester page

+ @@ -150,6 +175,7 @@

Byte efficiency tester page

+ @@ -157,6 +183,7 @@

Byte efficiency tester page

+ @@ -164,6 +191,7 @@

Byte efficiency tester page

+ @@ -171,6 +199,7 @@

Byte efficiency tester page

+ @@ -178,6 +207,7 @@

Byte efficiency tester page

+
@@ -185,6 +215,7 @@

Byte efficiency tester page

+
@@ -196,6 +227,7 @@

Byte efficiency tester page

+ diff --git a/lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html b/lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html index 729c4bc6e233..841ae069b6b2 100644 --- a/lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html +++ b/lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html @@ -450,6 +450,9 @@

Do better web tester page

Also, script is located down here to avoid being flagged in render-blocking-resources. --> + + + @@ -463,8 +466,8 @@

Do better web tester page

document.body.appendChild(img); }, console.error); } - - window.webkitRequestFileSystem(window.TEMPORARY, 1024 * 1024, onInitFs, console.error); + + window.webkitRequestFileSystem(window.TEMPORARY, 1024 * 1024, onInitFs, console.error); diff --git a/lighthouse-cli/test/fixtures/form.html b/lighthouse-cli/test/fixtures/form.html new file mode 100644 index 000000000000..083e558d305d --- /dev/null +++ b/lighthouse-cli/test/fixtures/form.html @@ -0,0 +1,143 @@ + + + + + + Autofill Smoke Test + + +
+ + +
+
+ + + / + +
+
+
+ +
+
+
+ Shipping address:
+
+
+
+ + +
+
+ +
+ +
+ + +
+ :
+ : + + / + +
+
+
+ +
+
+
+ Go back +
+ + \ No newline at end of file diff --git a/lighthouse-cli/test/fixtures/perf/animations.html b/lighthouse-cli/test/fixtures/perf/animations.html new file mode 100644 index 000000000000..306eb37dc7fa --- /dev/null +++ b/lighthouse-cli/test/fixtures/perf/animations.html @@ -0,0 +1,54 @@ + + + + + + + + +
+
+
AAAAAAAAAAAAAAAAAAA
+ + + + + diff --git a/lighthouse-cli/test/fixtures/perf/delayed-element.js b/lighthouse-cli/test/fixtures/perf/delayed-element.js index f267b9c57aec..4f472d5985e0 100644 --- a/lighthouse-cli/test/fixtures/perf/delayed-element.js +++ b/lighthouse-cli/test/fixtures/perf/delayed-element.js @@ -28,8 +28,9 @@ async function rerender(iterations) { setTimeout(() => { const imgEl = document.createElement('img'); imgEl.src = '../dobetterweb/lighthouse-480x318.jpg'; - const textEl = document.createElement('span'); + const textEl = document.createElement('div'); textEl.textContent = 'Sorry!'; + textEl.style.height = '18px' // this height can be flaky so we set it manually const top = document.getElementById('late-content'); top.appendChild(imgEl); top.appendChild(textEl); diff --git a/lighthouse-cli/test/fixtures/perf/trace-elements.html b/lighthouse-cli/test/fixtures/perf/trace-elements.html index 58ad27c20dd0..1624133ab13c 100644 --- a/lighthouse-cli/test/fixtures/perf/trace-elements.html +++ b/lighthouse-cli/test/fixtures/perf/trace-elements.html @@ -1,6 +1,21 @@ + +

Please don't move me

diff --git a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js index 665e5cd9c35c..f070a76c6fa1 100644 --- a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +++ b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js @@ -15,11 +15,11 @@ const ChromeLauncher = require('chrome-launcher'); const ChromeProtocol = require('../../../../lighthouse-core/gather/connections/cri.js'); // Load bundle, which creates a `global.runBundledLighthouse`. -// @ts-ignore - file won't exist until `yarn build-all`, but not used for types anyways. +// @ts-ignore - file exists if `yarn build-all` is run, but not used for types anyways. require('../../../../dist/lighthouse-dt-bundle.js'); // eslint-disable-line /** @type {import('../../../../lighthouse-core/index.js')} */ -// @ts-ignore - not worth giving test global an actual type. +// @ts-expect-error - not worth giving test global an actual type. const lighthouse = global.runBundledLighthouse; /** diff --git a/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js b/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js index d8852d8eaa66..00b2ed487e5e 100644 --- a/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +++ b/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js @@ -72,12 +72,6 @@ async function internalRun(url, tmpPath, configJson, isDebug) { args.push(`--config-path=${configPath}`); } - if (process.env.APPVEYOR) { - // Appveyor is hella slow already, disable CPU throttling so we're not 16x slowdown - // see https://github.com/GoogleChrome/lighthouse/issues/4891 - args.push('--throttling.cpuSlowdownMultiplier=1'); - } - const command = 'node'; const env = {...process.env, NODE_ENV: 'test'}; localConsole.log(`${log.dim}$ ${command} ${args.join(' ')} ${log.reset}`); diff --git a/lighthouse-cli/test/smokehouse/report-assert.js b/lighthouse-cli/test/smokehouse/report-assert.js index a5997d3505c9..e3cb4f9d4b93 100644 --- a/lighthouse-cli/test/smokehouse/report-assert.js +++ b/lighthouse-cli/test/smokehouse/report-assert.js @@ -277,9 +277,9 @@ function isPlainObject(obj) { * @param {Comparison} assertion */ function reportAssertion(localConsole, assertion) { - // @ts-ignore - this doesn't exist now but could one day, so try not to break the future + // @ts-expect-error - this doesn't exist now but could one day, so try not to break the future const _toJSON = RegExp.prototype.toJSON; - // @ts-ignore + // @ts-expect-error // eslint-disable-next-line no-extend-native RegExp.prototype.toJSON = RegExp.prototype.toString; @@ -312,7 +312,7 @@ function reportAssertion(localConsole, assertion) { } } - // @ts-ignore + // @ts-expect-error // eslint-disable-next-line no-extend-native RegExp.prototype.toJSON = _toJSON; } diff --git a/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/byte-config.js b/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/byte-config.js index f1f852c75d4c..e10b83c66a2c 100644 --- a/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/byte-config.js +++ b/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/byte-config.js @@ -16,6 +16,7 @@ const config = { 'accesskeys', // run axe on the page since we've had problems with interactions 'network-requests', 'offscreen-images', + 'uses-http2', 'uses-webp-images', 'uses-optimized-images', 'uses-text-compression', @@ -27,10 +28,14 @@ const config = { // image-size-responsive is not a byte-efficiency audit but a counterbalance to the byte-efficiency audits // that makes sense to test together. 'image-size-responsive', + // unsized-images is not a byte-efficiency audit but can easily leverage the variety of images present in + // byte-efficiency tests & thus makes sense to test together. + 'unsized-images', ], throttlingMethod: 'devtools', }, audits: [ + 'unsized-images', {path: 'byte-efficiency/unused-javascript', options: { // Lower the threshold so we don't need huge resources to make a test. unusedThreshold: 2000, diff --git a/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/expectations.js b/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/expectations.js index 743d13d269b1..f00559567a5e 100644 --- a/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/expectations.js +++ b/lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/expectations.js @@ -84,6 +84,15 @@ const expectations = [ requestedUrl: 'http://localhost:10200/byte-efficiency/tester.html', finalUrl: 'http://localhost:10200/byte-efficiency/tester.html', audits: { + 'uses-http2': { + score: '<1', + details: { + overallSavingsMs: '>0', + items: { + length: '>10', + }, + }, + }, 'unminified-css': { details: { overallSavingsBytes: '>17000', @@ -184,7 +193,7 @@ const expectations = [ details: { overallSavingsBytes: '>60000', items: { - length: 5, + length: 6, }, }, }, @@ -211,12 +220,13 @@ const expectations = [ // Check that images aren't TOO BIG. 'uses-responsive-images': { details: { - overallSavingsBytes: '108000 +/- 5000', + overallSavingsBytes: '113000 +/- 5000', items: [ {wastedPercent: '56 +/- 5', url: /lighthouse-1024x680.jpg/}, {wastedPercent: '78 +/- 5', url: /lighthouse-2048x1356.webp\?size0/}, {wastedPercent: '56 +/- 5', url: /lighthouse-480x320.webp/}, {wastedPercent: '20 +/- 5', url: /lighthouse-480x320.jpg/}, + {wastedPercent: '20 +/- 5', url: /lighthouse-480x320\.jpg\?attributesized/}, ], }, }, @@ -224,10 +234,20 @@ const expectations = [ 'image-size-responsive': { details: { items: [ - // One of these two is the ?duplicate variant but sort order isn't guaranteed + // One of these is the ?duplicate variant and another is the + // ?cssauto variant but sort order isn't guaranteed // since the pixel diff is equivalent for identical images. {url: /lighthouse-320x212-poor.jpg/}, {url: /lighthouse-320x212-poor.jpg/}, + {url: /lighthouse-320x212-poor.jpg/}, + ], + }, + }, + 'unsized-images': { + details: { + items: [ + {url: /lighthouse-320x212-poor\.jpg/}, + {url: /lighthouse-320x212-poor\.jpg\?cssauto/}, ], }, }, diff --git a/lighthouse-cli/test/smokehouse/test-definitions/core-tests.js b/lighthouse-cli/test/smokehouse/test-definitions/core-tests.js index 244bb3710e8f..c09c226e208a 100644 --- a/lighthouse-cli/test/smokehouse/test-definitions/core-tests.js +++ b/lighthouse-cli/test/smokehouse/test-definitions/core-tests.js @@ -74,6 +74,10 @@ const smokeTests = [{ id: 'source-maps', expectations: require('./source-maps/expectations.js'), config: require('./source-maps/source-maps-config.js'), +}, { + id: 'forms', + expectations: require('./forms/form-expectations.js'), + config: require('./forms/form-config.js'), }, { id: 'screenshot', expectations: require('./screenshot/expectations.js'), diff --git a/lighthouse-cli/test/smokehouse/test-definitions/dobetterweb/dbw-expectations.js b/lighthouse-cli/test/smokehouse/test-definitions/dobetterweb/dbw-expectations.js index f3ab16b71674..3616498086c1 100644 --- a/lighthouse-cli/test/smokehouse/test-definitions/dobetterweb/dbw-expectations.js +++ b/lighthouse-cli/test/smokehouse/test-definitions/dobetterweb/dbw-expectations.js @@ -256,14 +256,6 @@ const expectations = [ ], }, }, - 'uses-http2': { - score: 0, - details: { - items: { - length: '>15', - }, - }, - }, 'external-anchors-use-rel-noopener': { score: 0, warnings: [/Unable to determine.*/], @@ -406,10 +398,10 @@ const expectations = [ }, 'dom-size': { score: 1, - numericValue: 147, + numericValue: 148, details: { items: [ - {statistic: 'Total DOM Elements', value: '147'}, + {statistic: 'Total DOM Elements', value: '148'}, {statistic: 'Maximum DOM Depth', value: '4'}, { statistic: 'Maximum Child Elements', diff --git a/lighthouse-cli/test/smokehouse/test-definitions/forms/form-config.js b/lighthouse-cli/test/smokehouse/test-definitions/forms/form-config.js new file mode 100644 index 000000000000..dbd3c7580c7f --- /dev/null +++ b/lighthouse-cli/test/smokehouse/test-definitions/forms/form-config.js @@ -0,0 +1,16 @@ +/** + * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +'use strict'; + +/** + * @type {LH.Config.Json} + * Config file for running form gatherer tests. + */ +const config = { + extends: 'lighthouse:default', +}; + +module.exports = config; diff --git a/lighthouse-cli/test/smokehouse/test-definitions/forms/form-expectations.js b/lighthouse-cli/test/smokehouse/test-definitions/forms/form-expectations.js new file mode 100644 index 000000000000..426f16f93a2b --- /dev/null +++ b/lighthouse-cli/test/smokehouse/test-definitions/forms/form-expectations.js @@ -0,0 +1,293 @@ +/** + * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +'use strict'; + +/** + * @type {Array} + * Expected Lighthouse artifacts from Form gatherer + */ +const expectations = [ + { + artifacts: { + FormElements: [ + { + attributes: { + id: 'checkout', + name: 'checkout', + autocomplete: 'on', + nodeLabel: 'Name on card: \nCredit card number: \nExpiry Date: \nMM\n01\n02\n03\n04\n05\n06\n07\n08\n09…', + snippet: '
', + }, + inputs: [ + { + id: 'name_cc1', + name: 'name_cc1', + placeholder: 'John Doe', + autocomplete: 'cc-name', + nodeLabel: 'textarea', + snippet: '