-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
run.test.js.snap
543 lines (457 loc) · 16.8 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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`run allows to use peer dependencies in import 1`] = `
"
Size: [1m1.18 kB[22m [90mwith all dependencies, minified and gzipped[39m
"
`;
exports[`run find plugins in parent package.json 1`] = `
"
Size limit: [32m[1m1 kB[22m[39m
Size: [32m[1m20 B[22m[39m [90mgzipped[39m
"
`;
exports[`run 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[`run 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[`run shows brotli text when brotli and gzip in config 1`] = `
"
Size limit: [32m[1m1 kB[22m[39m
Size: [32m[1m-19 B[22m[39m [90mwith all dependencies, minified and brotli[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[`run shows brotli text when only brotli in config 1`] = `
"
Size limit: [32m[1m1 kB[22m[39m
Size: [32m[1m-19 B[22m[39m [90mwith all dependencies, minified and brotli[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[`run shows debug 1`] = `
"{
\\"cwd\\": \\"/tmp/\\",
\\"configPath\\": \\"package.json\\",
\\"checks\\": [
{
\\"limit\\": \\"200 B\\",
\\"files\\": [
\\"/packages/size-limit/test/fixtures/integration/index.js\\"
],
\\"name\\": \\"index.js\\",
\\"sizeLimit\\": 200,
\\"highlightLess\\": true,
\\"webpackOutput\\": \\"/tmp/\\",
\\"webpackConfig\\": {
\\"entry\\": {
\\"index\\": [
\\"/packages/size-limit/test/fixtures/integration/index.js\\"
]
},
\\"output\\": {
\\"path\\": \\"/tmp/\\"
},
\\"optimization\\": {
\\"concatenateModules\\": true,
\\"minimizer\\": [
\\"...\\",
{
\\"options\\": {
\\"test\\": {},
\\"parallel\\": true
}
}
]
},
\\"module\\": {
\\"rules\\": [
{
\\"test\\": {},
\\"type\\": \\"asset/resource\\"
},
{
\\"test\\": {},
\\"exclude\\": {},
\\"use\\": [
\\"/node_modules/style-loader/dist/cjs.js\\",
\\"/node_modules/css-loader/dist/cjs.js\\"
]
},
{
\\"test\\": {},
\\"use\\": [
\\"/node_modules/style-loader/dist/cjs.js\\",
{
\\"loader\\": \\"/node_modules/css-loader/dist/cjs.js\\",
\\"options\\": {
\\"modules\\": true
}
}
]
}
]
},
\\"plugins\\": []
},
\\"bundles\\": [
\\"/tmp/index.js\\"
],
\\"size\\": 141,
\\"loadTime\\": 0.01,
\\"runTime\\": 1,
\\"time\\": 1.01,
\\"passed\\": true
}
],
\\"failed\\": false,
\\"missed\\": false
}
[42m[30mPackage size is 59 B less than limit[39m[49m
Size limit: [32m[1m200 B[22m[39m
Size: [32m[1m141 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[`run shows debug on error 1`] = `
"{
\\"cwd\\": \\"/tmp/\\",
\\"configPath\\": \\"package.json\\",
\\"checks\\": [
{
\\"limit\\": \\"200 s\\",
\\"files\\": [
\\"/packages/size-limit/test/fixtures/internal-error/index.js\\"
],
\\"name\\": \\"index.js\\",
\\"timeLimit\\": 200
}
]
}
[41m[30m ERROR [39m[49m [31mAdd [33m@size-limit/file[31m plugin to Size Limit[39m
"
`;
exports[`run shows error on missed package.json 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit didn’t find [33mpackage.json[31m.
Create npm package and run Size Limit there.[39m
"
`;
exports[`run shows error on time bigger than limit 1`] = `
"
[31mTotal time limit has exceeded[39m
Time limit: [31m[1m1 s[22m[39m
Size: [31m[1m141 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[`run shows error on time bigger than limit. in silent mode 1`] = `
"
[31mTotal time limit has exceeded[39m
Time limit: [31m[1m1 s[22m[39m
Size: [31m[1m141 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[`run shows error when file not found for simple case 1`] = `
"
[31mSize Limit can’t find files at folder/index.js[39m
"
`;
exports[`run shows error when file not found for webpack 1`] = `
"
[31mSize Limit can’t find files at dist/*.js[39m
"
`;
exports[`run shows error when using brotli without webpack 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mbrotli[31m needs [33m@size-limit/webpack[31m plugin[39m
"
`;
exports[`run 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--hide-passed[39m Print only failed files
[33m--highlight-less[39m Highlight files with less than limit size
[33m--help[39m Display this help
[33m--watch[39m Runs in watch mode
[33m--silent[39m Show only failed limits
[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[`run 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[`run 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[`run 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[`run shows nothing in silent mode and success check 1`] = `
"
"
`;
exports[`run shows size-limit dependency warning 1`] = `""`;
exports[`run 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--hide-passed[39m Print only failed files
[33m--highlight-less[39m Highlight files with less than limit size
[33m--help[39m Display this help
[33m--watch[39m Runs in watch mode
[33m--silent[39m Show only failed limits
[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
[33m--clean-dir[39m Remove build files folder before start
[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[`run throws on --clean-dir argument without --save-bundle 1`] = `
"[41m[30m ERROR [39m[49m [31mArgument [33m--clean-dir[31m works only with [33m--save-bundle[31m argument[39m
"
`;
exports[`run throws on --save-bundle argument without DIR parameter 1`] = `
"[41m[30m ERROR [39m[49m [31mMissing parameter [33mDIR[31m for [33m--save-bundle[31m argument[39m
"
`;
exports[`run throws on --save-bundle argument without DIR parameter 2`] = `
"[41m[30m ERROR [39m[49m [31mMissing parameter [33mDIR[31m for [33m--save-bundle[31m argument[39m
"
`;
exports[`run throws on --save-bundle argument without webpack 1`] = `
"[41m[30m ERROR [39m[49m [31mArgument [33m--save-bundle[31m works only with [33m@size-limit/webpack[31m plugin[39m
"
`;
exports[`run throws on --why argument without webpack 1`] = `
"[41m[30m ERROR [39m[49m [31mArgument [33m--why[31m works only with [33m@size-limit/webpack[31m plugin.
You can add Bundle Analyzer to you own bundler.[39m
"
`;
exports[`run throws on empty config 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config must [33mnot be empty[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 kB\\"[39m
}
]
"
`;
exports[`run throws on gzip option without gzip plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mgzip[31m needs [33m@size-limit/webpack[31m or [33m@size-limit/file[31m plugin[39m
"
`;
exports[`run throws on no config 1`] = `
"[41m[30m ERROR [39m[49m [31mCreate Size Limit config in [33mpackage.json[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 kB\\"[39m
}
]
"
`;
exports[`run throws on non-array config 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config must contain [33man array[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 kB\\"[39m
}
]
"
`;
exports[`run throws on non-object check 1`] = `
"[41m[30m ERROR [39m[49m [31mSize Limit config array should contain [33monly objects[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 kB\\"[39m
}
]
"
`;
exports[`run throws on non-string entry 1`] = `
"[41m[30m ERROR [39m[49m [31mThe [33mentry[31m in Size Limit config must be [33ma string[31m or [33man array of strings[31m[39m
"
`;
exports[`run throws on non-string path 1`] = `
"[41m[30m ERROR [39m[49m [31mThe [33mpath[31m in Size Limit config must be [33ma string[31m or [33man array of strings[31m[39m
[32m\\"size-limit\\"[39m: [
{
[32m\\"path\\"[39m: [33m\\"dist/bundle.js\\"[39m,
[32m\\"limit\\"[39m: [33m\\"10 kB\\"[39m
}
]
"
`;
exports[`run throws on running option without time plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mrunning[31m needs [33m@size-limit/time[31m plugin[39m
"
`;
exports[`run throws on time limit without time plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mAdd [33m@size-limit/time[31m plugin to use time limit[39m
"
`;
exports[`run throws on unknown argument 1`] = `
"[41m[30m ERROR [39m[49m [31mUnknown argument [33m--unknown[31m.
Check command for typo and read docs.[39m
"
`;
exports[`run throws on unknown option 1`] = `
"[41m[30m ERROR [39m[49m [31mUnknown option [33munknown[31m in config.
Check Size Limit docs and version.[39m
"
`;
exports[`run throws on webpack option without webpack plugin 1`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mwebpack[31m needs [33m@size-limit/webpack[31m plugin[39m
"
`;
exports[`run throws on webpack option without webpack plugin 2`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mignore[31m needs [33m@size-limit/webpack[31m plugin[39m
"
`;
exports[`run throws on webpack option without webpack plugin 3`] = `
"[41m[30m ERROR [39m[49m [31mConfig option [33mconfig[31m needs [33m@size-limit/webpack[31m plugin[39m
"
`;
exports[`run 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--hide-passed[39m Print only failed files
[33m--highlight-less[39m Highlight files with less than limit size
[33m--help[39m Display this help
[33m--watch[39m Runs in watch mode
[33m--silent[39m Show only failed limits
[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
[33m--clean-dir[39m Remove build files folder before start
[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[`run works in integration test in watch 1`] = `
"
[42m[30mPackage size is 59 B less than limit[39m[49m
Size limit: [32m[1m200 B[22m[39m
Size: [32m[1m141 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[`run works in integration test with ESM 1`] = `
"
Size limit: [32m[1m1 B[22m[39m
Size: [32m[1m1 B[22m[39m [90mwith all dependencies, minified and gzipped[39m
"
`;
exports[`run works in integration test with JSON 1`] = `
"[
{
\\"name\\": \\"index.js\\",
\\"passed\\": true,
\\"size\\": 141,
\\"running\\": 1,
\\"loading\\": 0.01
}
]
"
`;
exports[`run works in integration test with size 1`] = `
"
[42m[30mPackage size is 59 B less than limit[39m[49m
Size limit: [32m[1m200 B[22m[39m
Size: [32m[1m141 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[`run works in integration test with time 1`] = `
"
Time limit: [32m[1m2 s[22m[39m
Size: [32m[1m141 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
"
`;