Skip to content

Commit d684e76

Browse files
authoredMar 2, 2022
core(script-treemap-data): correct value for size (#13716)
1 parent cded21a commit d684e76

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed
 

‎lighthouse-core/audits/script-treemap-data.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class ScriptTreemapDataAudit extends Audit {
197197

198198
nodes.push({
199199
name,
200-
resourceBytes: scriptElement.src.length,
200+
resourceBytes: scriptElement.content?.length || 0,
201201
});
202202
continue;
203203
}

‎lighthouse-core/test/audits/__snapshots__/script-treemap-data-test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -5795,7 +5795,7 @@ Array [
57955795
},
57965796
Object {
57975797
"name": "https://sqoosh.app/no-map-or-usage.js",
5798-
"resourceBytes": 37,
5798+
"resourceBytes": 5,
57995799
},
58005800
]
58015801
`;

‎lighthouse-core/test/audits/script-treemap-data-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('ScriptTreemapData audit', () => {
6464
.toMatchInlineSnapshot(`
6565
Object {
6666
"name": "https://sqoosh.app/no-map-or-usage.js",
67-
"resourceBytes": 37,
67+
"resourceBytes": 5,
6868
}
6969
`);
7070

@@ -79,7 +79,7 @@ describe('ScriptTreemapData audit', () => {
7979
}
8080
`);
8181

82-
expect(JSON.stringify(treemapData.nodes).length).toMatchInlineSnapshot(`6674`);
82+
expect(JSON.stringify(treemapData.nodes).length).toMatchInlineSnapshot(`6673`);
8383
expect(treemapData.nodes).toMatchSnapshot();
8484
});
8585
});

‎lighthouse-core/test/results/sample_v2.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3241,15 +3241,15 @@
32413241
},
32423242
{
32433243
"name": "http://localhost:10200/dobetterweb/empty_module.js?delay=500",
3244-
"resourceBytes": 60
3244+
"resourceBytes": 0
32453245
},
32463246
{
32473247
"name": "http://localhost:10200/dobetterweb/fake-script-wp-includes",
3248-
"resourceBytes": 58
3248+
"resourceBytes": 0
32493249
},
32503250
{
32513251
"name": "http://localhost:10200/dobetterweb/fcp-delayer.js?delay=5000",
3252-
"resourceBytes": 60
3252+
"resourceBytes": 0
32533253
},
32543254
{
32553255
"name": "http://localhost:10200/dobetterweb/third_party/aggressive-promise-polyfill.js",

0 commit comments

Comments
 (0)
Please sign in to comment.