Skip to content

Commit 672bb60

Browse files
authored
core(unused-javascript): augment with source maps
1 parent 1621bc7 commit 672bb60

File tree

18 files changed

+1297
-64
lines changed

18 files changed

+1297
-64
lines changed

Diff for: .eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
**/generated/**
88
**/source-maps/**
99

10+
lighthouse-cli/test/fixtures/byte-efficiency/bundle.js
11+
1012
/dist/**
1113

1214
coverage/**

Diff for: .eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = {
5050
'no-unused-vars': [2, {
5151
vars: 'all',
5252
args: 'after-used',
53-
argsIgnorePattern: '(^reject$|^_$)',
53+
argsIgnorePattern: '(^reject$|^_+$)',
5454
varsIgnorePattern: '(^_$)',
5555
}],
5656
'space-infix-ops': 2,

Diff for: lighthouse-cli/test/fixtures/byte-efficiency/bundle.js

+156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lighthouse-cli/test/fixtures/byte-efficiency/bundle.js.map

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lighthouse-cli/test/fixtures/byte-efficiency/tester.html

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
}
5555
</style>
5656
<script src="script.js" type="application/javascript"></script>
57+
<script src="bundle.js"></script>
5758
</head>
5859

5960
<body>

Diff for: lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/byte-config.js

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ const config = {
2727
],
2828
throttlingMethod: 'devtools',
2929
},
30+
// source-maps is not yet in the default config.
31+
passes: [{
32+
passName: 'defaultPass',
33+
gatherers: [
34+
'source-maps',
35+
],
36+
}],
3037
};
3138

3239
module.exports = config;

Diff for: lighthouse-cli/test/smokehouse/test-definitions/byte-efficiency/expectations.js

+47-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ const expectations = [
2929
source: 'head',
3030
devtoolsNodePath: '2,HTML,0,HEAD,5,SCRIPT',
3131
},
32+
{
33+
type: null,
34+
src: 'http://localhost:10200/byte-efficiency/bundle.js',
35+
async: false,
36+
defer: false,
37+
source: 'head',
38+
devtoolsNodePath: '2,HTML,0,HEAD,6,SCRIPT',
39+
},
3240
{
3341
type: null,
3442
src: null,
@@ -106,6 +114,12 @@ const expectations = [
106114
wastedBytes: '6559 +/- 100',
107115
wastedPercent: 100,
108116
},
117+
{
118+
url: 'http://localhost:10200/byte-efficiency/bundle.js',
119+
totalBytes: '13000 +/- 1000',
120+
wastedBytes: '2350 +/- 100',
121+
wastedPercent: '19 +/- 5',
122+
},
109123
],
110124
},
111125
},
@@ -122,9 +136,38 @@ const expectations = [
122136
details: {
123137
overallSavingsBytes: '>=25000',
124138
overallSavingsMs: '>300',
125-
items: {
126-
length: 2,
127-
},
139+
items: [
140+
{
141+
url: 'http://localhost:10200/byte-efficiency/script.js',
142+
totalBytes: '53000 +/- 1000',
143+
wastedBytes: '22000 +/- 1000',
144+
},
145+
{
146+
url: 'http://localhost:10200/byte-efficiency/tester.html',
147+
totalBytes: '15000 +/- 1000',
148+
wastedBytes: '6500 +/- 1000',
149+
},
150+
{
151+
url: 'http://localhost:10200/byte-efficiency/bundle.js',
152+
totalBytes: 12913,
153+
wastedBytes: 5827,
154+
sources: [
155+
'…./b.js',
156+
'…./c.js',
157+
'…webpack/bootstrap',
158+
],
159+
sourceBytes: [
160+
4417,
161+
2200,
162+
2809,
163+
],
164+
sourceWastedBytes: [
165+
2191,
166+
2182,
167+
1259,
168+
],
169+
},
170+
],
128171
},
129172
},
130173
'offscreen-images': {
@@ -156,7 +199,7 @@ const expectations = [
156199
overallSavingsMs: '>700',
157200
overallSavingsBytes: '>50000',
158201
items: {
159-
length: 2,
202+
length: 3,
160203
},
161204
},
162205
},

0 commit comments

Comments
 (0)