lighthouse 9.5.0-dev.20220705 → 9.5.0-dev.20220706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +15 -11
- package/package.json +2 -3
- package/tsconfig.json +0 -1
- package/third-party/devtools-tests/README.md +0 -14
- package/third-party/devtools-tests/e2e/lighthouse/BUILD.gn +0 -17
- package/third-party/devtools-tests/e2e/lighthouse/generate-report_test.ts +0 -29
- package/third-party/devtools-tests/e2e/lighthouse/indexeddb-warning_test.ts +0 -29
- package/third-party/devtools-tests/e2e/resources/lighthouse/BUILD.gn +0 -9
- package/third-party/devtools-tests/e2e/resources/lighthouse/lighthouse-storage.html +0 -11
|
@@ -21,10 +21,10 @@ const devtoolsDir =
|
|
|
21
21
|
* @param {string[]} logs
|
|
22
22
|
* @param {string} command
|
|
23
23
|
* @param {string[]} args
|
|
24
|
+
* @return {Promise<boolean>} true if command exited successfully.
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const promise = new Promise((resolve) => {
|
|
26
|
+
function spawnAndLog(logs, command, args) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
28
|
const spawnHandle = spawn(command, args);
|
|
29
29
|
spawnHandle.on('close', code => {
|
|
30
30
|
if (code) {
|
|
@@ -32,7 +32,7 @@ async function spawnAndLog(logs, command, args) {
|
|
|
32
32
|
} else {
|
|
33
33
|
logs.push('[SUCCESS] Command exited with code: 0\n');
|
|
34
34
|
}
|
|
35
|
-
resolve();
|
|
35
|
+
resolve(code === 0);
|
|
36
36
|
});
|
|
37
37
|
spawnHandle.on('error', (error) => {
|
|
38
38
|
logs.push(`ERROR: ${error.toString()}`);
|
|
@@ -48,21 +48,22 @@ async function spawnAndLog(logs, command, args) {
|
|
|
48
48
|
logs.push(`STDERR: ${data}`);
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
-
await promise;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
/** @type {Promise<
|
|
53
|
+
/** @type {Promise<boolean>} */
|
|
55
54
|
let buildDevtoolsPromise;
|
|
56
55
|
/**
|
|
57
|
-
* @param {string[]} logs
|
|
58
56
|
* Download/pull latest DevTools, build Lighthouse for DevTools, roll to DevTools, and build DevTools.
|
|
57
|
+
* @param {string[]} logs
|
|
59
58
|
*/
|
|
60
59
|
async function buildDevtools(logs) {
|
|
61
|
-
if (process.env.CI) return;
|
|
60
|
+
if (process.env.CI) return true;
|
|
62
61
|
|
|
63
62
|
process.env.DEVTOOLS_PATH = devtoolsDir;
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const success =
|
|
64
|
+
await spawnAndLog(logs, 'bash', ['lighthouse-core/test/devtools-tests/download-devtools.sh']) &&
|
|
65
|
+
await spawnAndLog(logs, 'bash', ['lighthouse-core/test/devtools-tests/roll-devtools.sh']);
|
|
66
|
+
return success;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
/**
|
|
@@ -80,7 +81,10 @@ async function runLighthouse(url, configJson, testRunnerOptions = {}) {
|
|
|
80
81
|
const logs = [];
|
|
81
82
|
|
|
82
83
|
if (!buildDevtoolsPromise) buildDevtoolsPromise = buildDevtools(logs);
|
|
83
|
-
await buildDevtoolsPromise
|
|
84
|
+
if (!await buildDevtoolsPromise) {
|
|
85
|
+
const log = logs.join('') + '\n';
|
|
86
|
+
throw new Error(`failed to build devtools:\n${log}`);
|
|
87
|
+
}
|
|
84
88
|
|
|
85
89
|
const outputDir = fs.mkdtempSync(os.tmpdir() + '/lh-smoke-cdt-runner-');
|
|
86
90
|
const chromeFlags = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.5.0-dev.
|
|
3
|
+
"version": "9.5.0-dev.20220706",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -76,8 +76,7 @@
|
|
|
76
76
|
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js",
|
|
77
77
|
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing && node ./lighthouse-core/scripts/update-flow-fixtures.js",
|
|
78
78
|
"update:flow-sample-json": "yarn i18n:collect-strings && node ./lighthouse-core/scripts/update-flow-fixtures.js",
|
|
79
|
-
"
|
|
80
|
-
"test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
|
|
79
|
+
"test-devtools": "bash lighthouse-core/test/devtools-tests/test-locally.sh",
|
|
81
80
|
"open-devtools": "bash lighthouse-core/scripts/open-devtools.sh",
|
|
82
81
|
"run-devtools": "node lighthouse-core/scripts/pptr-run-devtools.js",
|
|
83
82
|
"diff:sample-json": "yarn i18n:checks && bash lighthouse-core/scripts/assert-golden-lhr-unchanged.sh",
|
package/tsconfig.json
CHANGED
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"clients/test/**/*.js",
|
|
40
40
|
"lighthouse-cli/test/fixtures/**/*.js",
|
|
41
41
|
"lighthouse-core/scripts/legacy-javascript/variants",
|
|
42
|
-
"lighthouse-core/test/chromium-web-tests/webtests",
|
|
43
42
|
// These test files require further changes before they can be type checked.
|
|
44
43
|
"lighthouse-core/test/config/budget-test.js",
|
|
45
44
|
"lighthouse-core/test/config/config-helpers-test.js",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Devtools e2e Tests
|
|
2
|
-
|
|
3
|
-
These tests are rolled into the Chromium DevTools Frontend codebase. They "belong" to the devtools frontend, but are truly defined in this Lighthouse repo.
|
|
4
|
-
|
|
5
|
-
Run with `sh lighthouse-core/test/devtools-tests/test-locally.sh`.
|
|
6
|
-
|
|
7
|
-
See `lighthouse-core/test/chromium-web-tests/README.md` for more.
|
|
8
|
-
|
|
9
|
-
## Sync
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
rsync -ahvz --exclude='OWNERS' ~/src/devtools/devtools-frontend/test/e2e/lighthouse/ third-party/devtools-tests/e2e/lighthouse/
|
|
13
|
-
rsync -ahvz --exclude='OWNERS' ~/src/devtools/devtools-frontend/test/e2e/resources/lighthouse/ third-party/devtools-tests/e2e/resources/lighthouse/
|
|
14
|
-
```
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Copyright 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
# Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
# found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import("../../../third_party/typescript/typescript.gni")
|
|
6
|
-
|
|
7
|
-
node_ts_library("lighthouse") {
|
|
8
|
-
sources = [
|
|
9
|
-
"generate-report_test.ts",
|
|
10
|
-
"indexeddb-warning_test.ts",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
deps = [
|
|
14
|
-
"../../shared",
|
|
15
|
-
"../helpers",
|
|
16
|
-
]
|
|
17
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import {assert} from 'chai';
|
|
6
|
-
|
|
7
|
-
import {goToResource} from '../../shared/helper.js';
|
|
8
|
-
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
9
|
-
import {isGenerateReportButtonDisabled, navigateToLighthouseTab} from '../helpers/lighthouse-helpers.js';
|
|
10
|
-
|
|
11
|
-
describe('The Lighthouse Tab', function() {
|
|
12
|
-
this.timeout(20_000);
|
|
13
|
-
|
|
14
|
-
it('shows a button to generate a new report', async () => {
|
|
15
|
-
await navigateToLighthouseTab('empty.html');
|
|
16
|
-
|
|
17
|
-
const disabled = await isGenerateReportButtonDisabled();
|
|
18
|
-
assert.isFalse(disabled, 'The Generate Report button should not be disabled');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Broken on non-debug runs
|
|
22
|
-
it.skip('[crbug.com/1057948] shows generate report button even when navigating to an unreachable page', async () => {
|
|
23
|
-
await navigateToLighthouseTab('empty.html');
|
|
24
|
-
|
|
25
|
-
await goToResource('network/unreachable.rawresponse');
|
|
26
|
-
const disabled = await isGenerateReportButtonDisabled();
|
|
27
|
-
assert.isTrue(disabled, 'The Generate Report button should be disabled');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import {assert} from 'chai';
|
|
6
|
-
|
|
7
|
-
import {waitFor} from '../../shared/helper.js';
|
|
8
|
-
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
9
|
-
import {navigateToLighthouseTab} from '../helpers/lighthouse-helpers.js';
|
|
10
|
-
|
|
11
|
-
describe('IndexedDB warning', function() {
|
|
12
|
-
this.timeout(20_000);
|
|
13
|
-
|
|
14
|
-
it('displays when important data may affect performance', async () => {
|
|
15
|
-
await navigateToLighthouseTab('empty.html');
|
|
16
|
-
|
|
17
|
-
let warningElem = await waitFor('.lighthouse-warning-text.hidden');
|
|
18
|
-
const warningText1 = await warningElem.evaluate(node => node.textContent?.trim());
|
|
19
|
-
assert.strictEqual(warningText1, '');
|
|
20
|
-
|
|
21
|
-
await navigateToLighthouseTab('lighthouse/lighthouse-storage.html');
|
|
22
|
-
|
|
23
|
-
warningElem = await waitFor('.lighthouse-warning-text:not(.hidden)');
|
|
24
|
-
const expected =
|
|
25
|
-
'There may be stored data affecting loading performance in this location: IndexedDB. Audit this page in an incognito window to prevent those resources from affecting your scores.';
|
|
26
|
-
const warningText2 = await warningElem.evaluate(node => node.textContent?.trim());
|
|
27
|
-
assert.strictEqual(warningText2, expected);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Copyright 2022 The Chromium Authors. All rights reserved.
|
|
2
|
-
# Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
# found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import("../../../../scripts/build/ninja/copy.gni")
|
|
6
|
-
|
|
7
|
-
copy_to_gen("lighthouse") {
|
|
8
|
-
sources = [ "lighthouse-storage.html" ]
|
|
9
|
-
}
|