-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
run.test.js.snap
470 lines (407 loc) · 14.3 KB
/
run.test.js.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`returns zero bytes for empty file 1`] = `
"
Size limit: [32m[1m0 B[22m[39m
Size: [32m[1m0 B[22m[39m [90mwith all dependencies, minified and gzipped[39m
"
`;
exports[`returns zero bytes for empty file without gzip 1`] = `
"
Size limit: [32m[1m0 B[22m[39m
Size: [32m[1m0 B[22m[39m [90mwith all dependencies and minified[39m
"
`;
exports[`shows debug 1`] = `
"{
\\"configPath\\": \\"package.json\\",
\\"checks\\": [
{
\\"limit\\": \\"200 B\\",
\\"path\\": [
\\"/packages/size-limit/test/fixtures/integration/index.js\\"
],
\\"name\\": \\"index.js\\",
\\"sizeLimit\\": 200,
\\"webpackOutput\\": \\"/tmp/\\",
\\"webpackConfig\\": {
\\"entry\\": {
\\"index\\": [
\\"/packages/size-limit/test/fixtures/integration/index.js\\"
]
},
\\"output\\": {
\\"path\\": \\"/tmp/\\"
},
\\"optimization\\": {
\\"concatenateModules\\": true
},
\\"resolve\\": {
\\"plugins\\": [
{
\\"topLevelLoader\\": {}
}
]
},
\\"resolveLoader\\": {
\\"plugins\\": [
{}
]
},
\\"module\\": {
\\"rules\\": [
{
\\"test\\": {},
\\"use\\": \\"file-loader\\"
},
{
\\"test\\": {},
\\"exclude\\": {},
\\"use\\": [
\\"style-loader\\",
\\"css-loader\\"
]
},
{
\\"test\\": {},
\\"use\\": [
\\"style-loader\\",
{
\\"loader\\": \\"css-loader\\",
\\"options\\": {
\\"modules\\": true
}
}
]
}
]
},
\\"plugins\\": [
{
\\"pluginDescriptor\\": {
\\"name\\": \\"OptimizeCssAssetsWebpackPlugin\\"
},
\\"options\\": {
\\"assetProcessors\\": [
{
\\"phase\\": \\"compilation.optimize-chunk-assets\\",
\\"regExp\\": {}
}
],
\\"assetNameRegExp\\": {},
\\"cssProcessorOptions\\": {},
\\"cssProcessorPluginOptions\\": {}
},
\\"phaseAssetProcessors\\": {
\\"compilation.optimize-chunk-assets\\": [
{
\\"phase\\": \\"compilation.optimize-chunk-assets\\",
\\"regExp\\": {}
}
],
\\"compilation.optimize-assets\\": [],
\\"emit\\": []
},
\\"deleteAssetsMap\\": {}
}
]
},
\\"bundles\\": [
\\"/tmp/index.js\\"
],
\\"size\\": 31,
\\"loadTime\\": 0.01,
\\"runTime\\": 1,
\\"time\\": 1.01,
\\"passed\\": true
}
],
\\"failed\\": false
}
Size limit: [32m[1m200 B[22m[39m
Size: [32m[1m31 B [22m[39m [90mwith all dependencies, minified and gzipped[39m
Loading time: [32m[1m10 ms[22m[39m [90mon slow 3G[39m
Running time: [32m[1m1 s [22m[39m [90mon Snapdragon 410[39m
Total time: [32m[1m1.1 s[22m[39m
"
`;
exports[`shows debug on error 1`] = `
"{
\\"configPath\\": \\"package.json\\",
\\"checks\\": [
{
\\"limit\\": \\"200 s\\",
\\"path\\": [
\\"/packages/size-limit/test/fixtures/internal-error/index.js\\"
],
\\"name\\": \\"index.js\\",
\\"timeLimit\\": 200
}
]
}
[41m[30m ERROR [39m[49m [31mAdd [33m@size-limit/file[39m[31m plugin to Size Limit[39m
"
`;
exports[`shows error on missed package.json 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit didn’t find [33mpackage.json[39m[31m.[39m
[31m Create npm package and run Size Limit there.[39m
"
`;
exports[`shows error on time bigger than limit 1`] = `
"
[31mTotal time limit has exceeded[39m
Time limit: [31m[1m1 s[22m[39m
Size: [31m[1m31 B [22m[39m [90mwith all dependencies, minified and gzipped[39m
Loading time: [31m[1m10 ms[22m[39m [90mon slow 3G[39m
Running time: [31m[1m1 s [22m[39m [90mon Snapdragon 410[39m
Total time: [31m[1m1.1 s[22m[39m
[33mTry to reduce size or increase limit in [1m\\"size-limit\\"[22m section of [1mpackage.json[22m[39m
"
`;
exports[`shows help 1`] = `
"[33msize-limit [OPTION]… [FILE]…[39m
Check the real performance cost of your front-end project to users
[1mCore options:[22m
[33m--limit LIMIT[39m Set size or running time limit for files
[33m--json[39m Show results in JSON format
[33m--help[39m Display this help
[33m--debug[39m Show internal configs for issue report
[33m--version[39m Display version
[1mExamples:[22m
[33msize-limit[39m
Read configuration from [1mpackage.json[22m or [1m.size-limit.json[22m and check limit
[33m size-limit index.js[39m
Show the size of specific files
"
`;
exports[`shows migration guide for npm users 1`] = `
"[31mInstall Size Limit preset depends on type of the project[39m
For application, where you send JS bundle directly to users
[33mnpm install --save-dev @size-limit/preset-app[39m
For frameworks, components and big libraries
[33mnpm install --save-dev @size-limit/preset-big-lib[39m
For small (< 10 KB) libraries
[33mnpm install --save-dev @size-limit/preset-small-lib[39m
Check out docs for more complicated cases
[33mhttps://github.com/ai/size-limit/[39m
"
`;
exports[`shows migration guide for npm users: config 1, dep 0 1`] = `
"[31mInstall Size Limit preset depends on type of the project[39m
For application, where you send JS bundle directly to users
[33mnpm install --save-dev @size-limit/preset-app[39m
For frameworks, components and big libraries
[33mnpm install --save-dev @size-limit/preset-big-lib[39m
For small (< 10 KB) libraries
[33mnpm install --save-dev @size-limit/preset-small-lib[39m
Check out docs for more complicated cases
[33mhttps://github.com/ai/size-limit/[39m
You need to add size-limit dependency: [33mnpm install --save-dev size-limit[39m
"
`;
exports[`shows migration guide for npm users: without sl dev dep 1`] = `
"[43m[30m WARN [39m[49m You need to add size-limit dependency
In order for the plugins to work correctly
[33mnpm install --save-dev size-limit[39m
"
`;
exports[`shows migration guide for yarn users 1`] = `
"[31mInstall Size Limit preset depends on type of the project[39m
For application, where you send JS bundle directly to users
[33myarn add --dev @size-limit/preset-app[39m
For frameworks, components and big libraries
[33myarn add --dev @size-limit/preset-big-lib[39m
For small (< 10 KB) libraries
[33myarn add --dev @size-limit/preset-small-lib[39m
Check out docs for more complicated cases
[33mhttps://github.com/ai/size-limit/[39m
"
`;
exports[`shows migration guide for yarn users: config 1, dep 0 1`] = `
"[31mInstall Size Limit preset depends on type of the project[39m
For application, where you send JS bundle directly to users
[33myarn add --dev @size-limit/preset-app[39m
For frameworks, components and big libraries
[33myarn add --dev @size-limit/preset-big-lib[39m
For small (< 10 KB) libraries
[33myarn add --dev @size-limit/preset-small-lib[39m
Check out docs for more complicated cases
[33mhttps://github.com/ai/size-limit/[39m
You need to add size-limit dependency: [33myarn add --dev size-limit[39m
"
`;
exports[`shows migration guide for yarn users: without sl dev dep 1`] = `
"[43m[30m WARN [39m[49m You need to add size-limit dependency
In order for the plugins to work correctly
[33myarn add --dev size-limit[39m
"
`;
exports[`shows size-limit dependency warning 1`] = `""`;
exports[`shows webpack-related help 1`] = `
"[33msize-limit [OPTION]… [FILE]…[39m
Check the real performance cost of your front-end project to users
[1mCore options:[22m
[33m--limit LIMIT[39m Set size or running time limit for files
[33m--json[39m Show results in JSON format
[33m--help[39m Display this help
[33m--debug[39m Show internal configs for issue report
[33m--version[39m Display version
[1mWebpack options:[22m
[33m--why[39m Show package content
[33m--save-bundle DIR[39m Put build files to check them by hand
[1mExamples:[22m
[33msize-limit[39m
Read configuration from [1mpackage.json[22m or [1m.size-limit.json[22m and check limit
[33m size-limit index.js[39m
Show the size of specific files with all file dependencies
[33msize-limit --why[39m
Show reasons why project have this size
"
`;
exports[`throws on --save-bundle argument without webpack 1`] = `
"[41m[30m ERROR [39m[49m [31mArgument [33m--save-bundle[39m[31m works only with [33m@size-limit/webpack[39m[31m plugin[39m
"
`;
exports[`throws on --why argument without webpack 1`] = `
"[41m[30m ERROR [39m[49m [31mArgument [33m--why[39m[31m works only with [33m@size-limit/webpack[39m[31m plugin.[39m
[31m You can add Bundle Analyzer to you own bundler.[39m
"
`;
exports[`throws on empty config 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config must [33mnot be empty[39m[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 KB\\"[39m
}
]
"
`;
exports[`throws on gzip option without gzip plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mgzip[39m[31m needs [33m@size-limit/webpack[39m[31m plugin[39m
"
`;
exports[`throws on no config 1`] = `
"[41m[30m ERROR [39m[49m [31mCreate Size Limit config in [33mpackage.json[39m[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 KB\\"[39m
}
]
"
`;
exports[`throws on non-array config 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config must contain [33man array[39m[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 KB\\"[39m
}
]
"
`;
exports[`throws on non-object check 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config array should contain [33monly objects[39m[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 KB\\"[39m
}
]
"
`;
exports[`throws on non-string entry 1`] = `
"[41m[30m ERROR [39m[49m [31mThe [33mentry[39m[31m in Size Limit config must be [33ma string[39m[31m or [33man array of strings[39m[31m[39m
"
`;
exports[`throws on non-string path 1`] = `
"[41m[30m ERROR [39m[49m [31mThe [33mpath[39m[31m in Size Limit config must be [33ma string[39m[31m or [33man array of strings[39m[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 KB\\"[39m
}
]
"
`;
exports[`throws on running option without time plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mrunning[39m[31m needs [33m@size-limit/time[39m[31m plugin[39m
"
`;
exports[`throws on time limit without time plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mAdd [33m@size-limit/time[39m[31m plugin to use time limit[39m
"
`;
exports[`throws on unknown argument 1`] = `
"[41m[30m ERROR [39m[49m [31mUnknown argument [33m--unknown[39m[31m.[39m
[31m Check command for typo and read docs.[39m
"
`;
exports[`throws on unknown option 1`] = `
"[41m[30m ERROR [39m[49m [31mUnknown option [33munknown[39m[31m in config.[39m
[31m Check Size Limit docs and version.[39m
"
`;
exports[`throws on webpack option without webpack plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mwebpack[39m[31m needs [33m@size-limit/webpack[39m[31m plugin[39m
"
`;
exports[`throws on webpack option without webpack plugin 2`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mignore[39m[31m needs [33m@size-limit/webpack[39m[31m plugin[39m
"
`;
exports[`throws on webpack option without webpack plugin 3`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mconfig[39m[31m needs [33m@size-limit/webpack[39m[31m plugin[39m
"
`;
exports[`uses dependencies to detect plugins 1`] = `
"[33msize-limit [OPTION]… [FILE]…[39m
Check the real performance cost of your front-end project to users
[1mCore options:[22m
[33m--limit LIMIT[39m Set size or running time limit for files
[33m--json[39m Show results in JSON format
[33m--help[39m Display this help
[33m--debug[39m Show internal configs for issue report
[33m--version[39m Display version
[1mWebpack options:[22m
[33m--why[39m Show package content
[33m--save-bundle DIR[39m Put build files to check them by hand
[1mExamples:[22m
[33msize-limit[39m
Read configuration from [1mpackage.json[22m or [1m.size-limit.json[22m and check limit
[33m size-limit index.js[39m
Show the size of specific files with all file dependencies
[33msize-limit --why[39m
Show reasons why project have this size
"
`;
exports[`works in integration test with JSON 1`] = `
"[
{
\\"name\\": \\"index.js\\",
\\"passed\\": true,
\\"size\\": 31,
\\"running\\": 1,
\\"loading\\": 0.01
}
]
"
`;
exports[`works in integration test with size 1`] = `
"
Size limit: [32m[1m200 B[22m[39m
Size: [32m[1m31 B [22m[39m [90mwith all dependencies, minified and gzipped[39m
Loading time: [32m[1m10 ms[22m[39m [90mon slow 3G[39m
Running time: [32m[1m1 s [22m[39m [90mon Snapdragon 410[39m
Total time: [32m[1m1.1 s[22m[39m
"
`;
exports[`works in integration test with time 1`] = `
"
Time limit: [32m[1m2 s[22m[39m
Size: [32m[1m31 B [22m[39m [90mwith all dependencies, minified and gzipped[39m
Loading time: [32m[1m10 ms[22m[39m [90mon slow 3G[39m
Running time: [32m[1m1 s [22m[39m [90mon Snapdragon 410[39m
Total time: [32m[1m1.1 s[22m[39m
"
`;