misc(proto): require protobuf 3.7.1, add stricter audit details test (#8867)

This commit is contained in:
Brendan Kenny 2019-05-05 16:52:22 -07:00 коммит произвёл Paul Irish
Родитель 6846807c4d
Коммит 24fe98250b
2 изменённых файлов: 5 добавлений и 18 удалений

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

@ -21,23 +21,10 @@ describe('round trip JSON comparison subsets', () => {
sampleJson = JSON.parse(preprocessor.processForProto(sample)); sampleJson = JSON.parse(preprocessor.processForProto(sample));
}); });
it('has the same audit results sans details', () => { it('has the same audit results and details (if applicable)', () => {
Object.keys(sampleJson.audits).forEach(audit => { for (const auditId of Object.keys(sampleJson.audits)) {
delete sampleJson.audits[audit].details; expect(roundTripJson.audits[auditId]).toEqual(sampleJson.audits[auditId]);
}); }
expect(roundTripJson.audits).toMatchObject(sampleJson.audits);
});
it('has the same audit results & details if applicable', () => {
Object.keys(sampleJson.audits).forEach(auditId => {
expect(roundTripJson.audits[auditId]).toMatchObject(sampleJson.audits[auditId]);
if ('details' in sampleJson.audits[auditId]) {
expect(roundTripJson.audits[auditId].details)
.toMatchObject(sampleJson.audits[auditId].details);
}
});
}); });
it('has the same i18n rendererFormattedStrings', () => { it('has the same i18n rendererFormattedStrings', () => {

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

@ -59,7 +59,7 @@
"ultradumbBenchmark": "./lighthouse-core/scripts/benchmark.js", "ultradumbBenchmark": "./lighthouse-core/scripts/benchmark.js",
"mixed-content": "./lighthouse-cli/index.js --chrome-flags='--headless' --preset=mixed-content", "mixed-content": "./lighthouse-cli/index.js --chrome-flags='--headless' --preset=mixed-content",
"minify-latest-run": "./lighthouse-core/scripts/lantern/minify-trace.js ./latest-run/defaultPass.trace.json ./latest-run/defaultPass.trace.min.json && ./lighthouse-core/scripts/lantern/minify-devtoolslog.js ./latest-run/defaultPass.devtoolslog.json ./latest-run/defaultPass.devtoolslog.min.json", "minify-latest-run": "./lighthouse-core/scripts/lantern/minify-trace.js ./latest-run/defaultPass.trace.json ./latest-run/defaultPass.trace.min.json && ./lighthouse-core/scripts/lantern/minify-devtoolslog.js ./latest-run/defaultPass.devtoolslog.json ./latest-run/defaultPass.devtoolslog.min.json",
"compile-proto": "[ \"$(protoc --version)\" == 'libprotoc 3.6.1' ] && protoc --python_out=./ ./proto/lighthouse-result.proto && mv ./proto/*_pb2.py ./proto/scripts || (echo \"❌ Install protobuf to compile the proto file.\" && false)", "compile-proto": "protoc --python_out=./ ./proto/lighthouse-result.proto && mv ./proto/*_pb2.py ./proto/scripts || (echo \"❌ Install protobuf ≥ 3.7.1 to compile the proto file.\" && false)",
"build-proto-roundtrip": "cd proto/scripts && PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 python json_roundtrip_via_proto.py" "build-proto-roundtrip": "cd proto/scripts && PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 python json_roundtrip_via_proto.py"
}, },
"devDependencies": { "devDependencies": {