core: fix sample_v2 generation, proto errors (#8605)

This commit is contained in:
Brendan Kenny 2019-04-25 17:28:26 -07:00 коммит произвёл GitHub
Родитель b2abbe7426
Коммит 0d1faf7057
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@ -25,7 +25,12 @@ async function update() {
}));
const url = `http://localhost:${port}/dobetterweb/dbw_tester.html`;
const flags = cliFlags.getFlags(`--gather-mode=lighthouse-core/test/results/artifacts ${url}`);
const rawFlags = [
'--gather-mode=lighthouse-core/test/results/artifacts',
'--throttling-method=devtools',
url,
].join(' ');
const flags = cliFlags.getFlags(rawFlags);
await cli.runLighthouse(url, flags, undefined);
await new Promise(res => server.close(res));
}

Просмотреть файл

@ -45,12 +45,19 @@ describe('round trip JSON comparison subsets', () => {
});
it('has the same top level values', () => {
// Don't test all top level properties that are objects.
Object.keys(sampleJson).forEach(audit => {
if (typeof sampleJson[audit] === 'object' && !Array.isArray(sampleJson[audit])) {
delete sampleJson[audit];
}
});
// Properties set to their type's default value will be omitted in the roundTripJson.
// For an explicit list of properties, remove sampleJson values if set to a default.
if (Array.isArray(sampleJson.stackPacks) && sampleJson.stackPacks.length === 0) {
delete sampleJson.stackPacks;
}
expect(roundTripJson).toMatchObject(sampleJson);
});

Просмотреть файл

@ -53,7 +53,7 @@
"type-check": "tsc -p . && tsc -p lighthouse-viewer/",
"i18n:checks": "./lighthouse-core/scripts/i18n/assert-strings-collected.sh",
"i18n:collect-strings": "node lighthouse-core/scripts/i18n/collect-strings.js",
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js -G",
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js",
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --throttling-method=devtools --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 && yarn compile-proto && yarn build-proto-roundtrip",
"diff:sample-json": "yarn i18n:checks && bash lighthouse-core/scripts/assert-golden-lhr-unchanged.sh",
"ultradumbBenchmark": "./lighthouse-core/scripts/benchmark.js",

Просмотреть файл

@ -161,6 +161,9 @@ message LighthouseResult {
string entry_type = 2;
google.protobuf.DoubleValue start_time = 3;
google.protobuf.DoubleValue duration = 4;
// Whether timing entry was collected during artifact gathering.
bool gather = 5;
}
// The total duration of Lighthouse's run

Просмотреть файл

@ -3652,11 +3652,10 @@
"warningAuditsGroupTitle": "Passed audits but with warnings",
"warningHeader": "Warnings: "
}
},
},
"lighthouseVersion": "4.3.0",
"requestedUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
"runWarnings": [],
"stackPacks": [],
"runWarnings": [],
"timing": {
"entries": [
{

2
types/lhr.d.ts поставляемый
Просмотреть файл

@ -61,7 +61,7 @@ declare global {
/** The record of all formatted string locations in the LHR and their corresponding source values. */
i18n: {rendererFormattedStrings: I18NRendererStrings, icuMessagePaths: I18NMessages};
/** An array containing the result of all stack packs. */
stackPacks: Result.StackPack[];
stackPacks?: Result.StackPack[];
}
// Result namespace