Skip to content

Commit

Permalink
Merge branch 'hsts-audit' of https://github.com/sebastian9er/lighthouse
Browse files Browse the repository at this point in the history
… into hsts-audit
  • Loading branch information
sebastian9er committed Nov 15, 2024
2 parents f5df3de + 729bb25 commit 9ba1ee1
Show file tree
Hide file tree
Showing 57 changed files with 4,379 additions and 3,895 deletions.
54 changes: 54 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
<a name="12.2.2"></a>
# 12.2.2 (2024-11-14)
[Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v12.2.1...v12.2.2)

We expect this release to ship in the DevTools of [Chrome 133](https://chromiumdash.appspot.com/schedule), and to PageSpeed Insights within 2 weeks.

## New contributors

Thanks to our new contributors 👽🐷🐰🐯🐻!

- Nate @servusdei2018
- Gareth Jones @G-Rath
- JDev @JWebDev

## Core

* network-monitor: treat EventSource as non-critical ([#16225](https://github.com/GoogleChrome/lighthouse/pull/16225))
* target-manager: ignore target if type is unknown ([#16221](https://github.com/GoogleChrome/lighthouse/pull/16221))

## CLI

* create writeFile destination if necessary ([#15990](https://github.com/GoogleChrome/lighthouse/pull/15990))

## Deps

* upgrade puppeteer to 23.8.0 ([#16248](https://github.com/GoogleChrome/lighthouse/pull/16248))
* upgrade `third-party-web` to 0.26.1 ([#16219](https://github.com/GoogleChrome/lighthouse/pull/16219))
* upgrade puppeteer to 23.5.2 ([#16220](https://github.com/GoogleChrome/lighthouse/pull/16220))
* lighthouse-stack-packs: upgrade to 1.12.2 ([#16242](https://github.com/GoogleChrome/lighthouse/pull/16242))
* lodash: migrate lodash to lodash-es ([#16211](https://github.com/GoogleChrome/lighthouse/pull/16211))
* sentry: upgrade to v7 ([#16215](https://github.com/GoogleChrome/lighthouse/pull/16215))

## Clients

* lr: set CPU throttling based on benchmark ([#16226](https://github.com/GoogleChrome/lighthouse/pull/16226))
* lr: fix wrong render-blocking-resources transfer size ([#16190](https://github.com/GoogleChrome/lighthouse/pull/16190))

## I18n

* import ([#16250](https://github.com/GoogleChrome/lighthouse/pull/16250))

## Docs

* readme: add `lighthouse-matchers` to related projects ([#16239](https://github.com/GoogleChrome/lighthouse/pull/16239))
* readme: add Guardius to services list ([#16235](https://github.com/GoogleChrome/lighthouse/pull/16235))

## Tests

* smoke: fix devtools test runner & a11y errors ([#16236](https://github.com/GoogleChrome/lighthouse/pull/16236))

## Misc

* ci: upgrade old actions ([#16191](https://github.com/GoogleChrome/lighthouse/pull/16191))

<a name="12.2.1"></a>
# 12.2.1 (2024-09-06)
[Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v12.2.0...v12.2.1)
Expand Down
15 changes: 10 additions & 5 deletions cli/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import fs from 'fs';
import path from 'path';

import log from 'lighthouse-logger';

Expand Down Expand Up @@ -58,13 +59,17 @@ function writeToStdout(output) {
*/
function writeFile(filePath, output, outputMode) {
return new Promise((resolve, reject) => {
// TODO: make this mkdir to the filePath.
fs.writeFile(filePath, output, (err) => {
if (err) {
fs.mkdir(path.dirname(filePath), {recursive: true}, (err) => {
if (err && err.code !== 'EEXIST') {
return reject(err);
}
log.log('Printer', `${OutputMode[outputMode]} output written to ${filePath}`);
resolve();
fs.writeFile(filePath, output, (err) => {
if (err) {
return reject(err);
}
log.log('Printer', `${OutputMode[outputMode]} output written to ${filePath}`);
resolve();
});
});
});
}
Expand Down
23 changes: 19 additions & 4 deletions cli/test/cli/printer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import assert from 'assert/strict';
import fs from 'fs';
import path from 'path';

import {readJson} from '../../../core/test/test-utils.js';
import * as Printer from '../../printer.js';
Expand Down Expand Up @@ -34,11 +35,9 @@ describe('Printer', () => {
});

it('throws for invalid paths', () => {
const path = '!/#@.json';
const path = '//#@.json';
const report = JSON.stringify(sampleResults);
return Printer.write(report, 'html', path).catch(err => {
assert.ok(err.code === 'ENOENT');
});
return assert.rejects(Printer.write(report, 'html', path));
});

it('returns output modes', () => {
Expand All @@ -49,4 +48,20 @@ describe('Printer', () => {
assert.strictEqual(typeof mode, 'string');
});
});

it('creates missing directories when writing to file', () => {
const dirPath = './non/existent/directory/.test-file.json';
const report = JSON.stringify(sampleResults);
const dir = path.dirname(dirPath);
if (fs.existsSync(dir)) {
fs.rmdirSync(dir, {recursive: true});
}
return Printer.write(report, 'json', dirPath).then(_ => {
assert.ok(fs.existsSync(dir), `Directory ${dir} should exist now`);
const fileContents = fs.readFileSync(dirPath, 'utf8');
assert.ok(/lighthouseVersion/gim.test(fileContents));
fs.unlinkSync(dirPath);
fs.rmdirSync(dir, {recursive: true});
});
});
});
8 changes: 4 additions & 4 deletions core/test/fixtures/user-flows/reports/sample-flow-result.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"steps": [
{
"lhr": {
"lighthouseVersion": "12.2.1",
"lighthouseVersion": "12.2.2",
"requestedUrl": "https://www.mikescerealshack.co/",
"mainDocumentUrl": "https://www.mikescerealshack.co/",
"finalDisplayedUrl": "https://www.mikescerealshack.co/",
Expand Down Expand Up @@ -8417,7 +8417,7 @@
},
{
"lhr": {
"lighthouseVersion": "12.2.1",
"lighthouseVersion": "12.2.2",
"finalDisplayedUrl": "https://www.mikescerealshack.co/search?q=call+of+duty",
"fetchTime": "2024-04-18T17:03:07.290Z",
"gatherMode": "timespan",
Expand Down Expand Up @@ -12412,7 +12412,7 @@
},
{
"lhr": {
"lighthouseVersion": "12.2.1",
"lighthouseVersion": "12.2.2",
"finalDisplayedUrl": "https://www.mikescerealshack.co/search?q=call+of+duty",
"fetchTime": "2024-04-18T17:03:17.899Z",
"gatherMode": "snapshot",
Expand Down Expand Up @@ -17808,7 +17808,7 @@
},
{
"lhr": {
"lighthouseVersion": "12.2.1",
"lighthouseVersion": "12.2.2",
"requestedUrl": "https://www.mikescerealshack.co/corrections",
"mainDocumentUrl": "https://www.mikescerealshack.co/corrections",
"finalDisplayedUrl": "https://www.mikescerealshack.co/corrections",
Expand Down
2 changes: 1 addition & 1 deletion core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lighthouseVersion": "12.2.1",
"lighthouseVersion": "12.2.2",
"requestedUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
"mainDocumentUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
"finalDisplayedUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ A Lighthouse plugin is just a node module with a name that starts with `lighthou
"type": "module",
"main": "plugin.js",
"peerDependencies": {
"lighthouse": "^12.2.1"
"lighthouse": "^12.2.2"
},
"devDependencies": {
"lighthouse": "^12.2.1"
"lighthouse": "^12.2.2"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/lighthouse-plugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"main": "./plugin.js",
"peerDependencies": {
"lighthouse": "^12.2.1"
"lighthouse": "^12.2.2"
},
"devDependencies": {
"lighthouse": "^8.6.0"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lighthouse",
"type": "module",
"version": "12.2.1",
"version": "12.2.2",
"description": "Automated auditing, performance metrics, and best practices for the web.",
"main": "./core/index.js",
"bin": {
Expand Down Expand Up @@ -167,7 +167,7 @@
"pako": "^2.0.3",
"preact": "^10.7.2",
"pretty-json-stringify": "^0.0.2",
"puppeteer": "^23.5.2",
"puppeteer": "^23.8.0",
"resolve": "^1.22.1",
"rollup": "^2.52.7",
"rollup-plugin-polyfill-node": "^0.12.0",
Expand Down Expand Up @@ -200,7 +200,7 @@
"metaviewport-parser": "0.3.0",
"open": "^8.4.0",
"parse-cache-control": "1.0.1",
"puppeteer-core": "^23.5.2",
"puppeteer-core": "^23.8.0",
"robots-parser": "^3.0.1",
"semver": "^5.3.0",
"speedline-core": "^1.4.3",
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ This section details services that have integrated Lighthouse data. If you're wo

* **[DeploymentHawk](https://deploymenthawk.com)** - DeploymentHawk is an automated site auditing tool powered by Lighthouse. Effortlessly catch performance, accessibility, and SEO issues before they impact your users. DeploymentHawk is a paid product with a free 7-day trial.

* **[Guardius](https://guardius.io)** - Guardius is a DevOps and DevSecOps SaaS platform that integrates Lighthouse to deliver automated web performance analysis. It not only provides metrics evaluation and automatic scanning but also enables performance comparisons across different periods and ongoing observation over time. Additionally, Guardius offers predefined and customized alerts tailored to your specific requirements. A free version of Guardius is available for users to explore its features.

## Lighthouse Integrations in non-Web Perf services

* **[PageWatch](https://pagewatch.dev/)** — PageWatch is a tool to find problem pages on your website. It provides insights into spelling errors, layout issues, slow pages (powered by Lighthouse) and more. PageWatch is offered via free and paid plans.
Expand Down Expand Up @@ -399,6 +401,7 @@ Other awesome open source projects that use Lighthouse.
* **[lighthouse-gh-reporter](https://github.com/carlesnunez/lighthouse-gh-reporter)** - Run Lighthouse in CI and report back in a comment on your pull requests
* **[lighthouse-jest-example](https://github.com/justinribeiro/lighthouse-jest-example)** - Gather performance metrics via Lighthouse and assert results with Jest; uses Puppeteer to start Chrome with network emulation settings defined by WebPageTest.
* **[lighthouse-lambda](https://github.com/Otterseer/lighthouse-lambda)** - Run Lighthouse on AWS Lambda with prebuilt stable desktop Headless Chrome.
* **[lighthouse-matchers](https://github.com/ackama/lighthouse-matchers)** - Provides RSpec matchers for executing and evaluating Google Chrome Lighthouse audit scores.
* **[lighthouse-mocha-example](https://github.com/rishichawda/lighthouse-mocha-example)** - Run Lighthouse performance tests with Mocha and chrome-launcher.
* **[lighthouse-monitor](https://github.com/verivox/lighthouse-monitor)** - Run Lighthouse against all your URLs. Send metrics to any backend you want, save all reports with automatic data retention, and compare any two results in a web UI.
* **[lighthouse-persist](https://github.com/foo-software/lighthouse-persist)** - Run Lighthouse and upload HTML reports to an AWS S3 bucket.
Expand Down
Loading

0 comments on commit 9ba1ee1

Please sign in to comment.