Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions lighthouse-core/test/report/proto-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,10 @@ describe('round trip JSON comparison subsets', () => {
sampleJson = JSON.parse(preprocessor.processForProto(sample));
});

it('has the same audit results sans details', () => {
Object.keys(sampleJson.audits).forEach(audit => {
delete sampleJson.audits[audit].details;
});

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 audit results and details (if applicable)', () => {
for (const auditId of Object.keys(sampleJson.audits)) {
expect(roundTripJson.audits[auditId]).toEqual(sampleJson.audits[auditId]);
}
});

it('has the same i18n rendererFormattedStrings', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ultradumbBenchmark": "./lighthouse-core/scripts/benchmark.js",
"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",
"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 --version)\" == 'libprotoc 3.7.1' ] && protoc --python_out=./ ./proto/lighthouse-result.proto && mv ./proto/*_pb2.py ./proto/scripts || (echo \"❌ Install protobuf to compile the proto file.\" && false)",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish sounds like we don't want the version test anymore, though? Probably good cause future versions wouldn't match and I'm not sure if the version check will work cross platform (we don't run update:sample-json on appveyor...)

"build-proto-roundtrip": "cd proto/scripts && PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 python json_roundtrip_via_proto.py"
},
"devDependencies": {
Expand Down