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

core(script-treemap-data): correct value for size #13716

Merged
merged 2 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lighthouse-core/audits/script-treemap-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class ScriptTreemapDataAudit extends Audit {

nodes.push({
name,
resourceBytes: scriptElement.src.length,
resourceBytes: scriptElement.content?.length || 0,
});
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5795,7 +5795,7 @@ Array [
},
Object {
"name": "https://sqoosh.app/no-map-or-usage.js",
"resourceBytes": 37,
"resourceBytes": 5,
},
]
`;
4 changes: 2 additions & 2 deletions lighthouse-core/test/audits/script-treemap-data-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('ScriptTreemapData audit', () => {
.toMatchInlineSnapshot(`
Object {
"name": "https://sqoosh.app/no-map-or-usage.js",
"resourceBytes": 37,
"resourceBytes": 5,
}
`);

Expand All @@ -79,7 +79,7 @@ describe('ScriptTreemapData audit', () => {
}
`);

expect(JSON.stringify(treemapData.nodes).length).toMatchInlineSnapshot(`6674`);
expect(JSON.stringify(treemapData.nodes).length).toMatchInlineSnapshot(`6673`);
expect(treemapData.nodes).toMatchSnapshot();
});
});
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3241,15 +3241,15 @@
},
{
"name": "http://localhost:10200/dobetterweb/empty_module.js?delay=500",
"resourceBytes": 60
"resourceBytes": 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok so this is where it matters: when a scriptelement references an invalid script resource, we still try to show it in the treemap.

the upcoming #13704 will resolve this (we will only look at real scripts)

},
{
"name": "http://localhost:10200/dobetterweb/fake-script-wp-includes",
"resourceBytes": 58
"resourceBytes": 0
},
{
"name": "http://localhost:10200/dobetterweb/fcp-delayer.js?delay=5000",
"resourceBytes": 60
"resourceBytes": 0
},
{
"name": "http://localhost:10200/dobetterweb/third_party/aggressive-promise-polyfill.js",
Expand Down