-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
loader.test.js.snap
623 lines (497 loc) · 15.8 KB
/
loader.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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`loader should add a file with an error as dependency so that the watcher is triggered when the error is fixed: errors 1`] = `
[
"ModuleBuildError: Module build failed (from \`replaced original path\`):
",
]
`;
exports[`loader should add a file with an error as dependency so that the watcher is triggered when the error is fixed: warnings 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including aliased ones: errors 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including aliased ones: warnings 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including node_modules: errors 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including node_modules: warnings 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including those from the Less resolver: errors 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies, including those from the Less resolver: warnings 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies: errors 1`] = `[]`;
exports[`loader should add all resolved imports as dependencies: warnings 1`] = `[]`;
exports[`loader should add path to dependencies: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should add path to dependencies: errors 1`] = `[]`;
exports[`loader should add path to dependencies: warnings 1`] = `[]`;
exports[`loader should allow to import non-less files: css 1`] = `
".some-file {
background: hotpink;
}
"
`;
exports[`loader should allow to import non-less files: errors 1`] = `[]`;
exports[`loader should allow to import non-less files: warnings 1`] = `[]`;
exports[`loader should be able to import a file with an absolute path: css 1`] = `
".it-works {
color: yellow;
}
"
`;
exports[`loader should be able to import a file with an absolute path: errors 1`] = `[]`;
exports[`loader should be able to import a file with an absolute path: warnings 1`] = `[]`;
exports[`loader should compile data-uri function: css 1`] = `
".img {
background: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%3E%0A%20%20%20%20%3Ccircle%20cx%3D%2220%22%20cy%3D%2220%22%20r%3D%2210%22%2F%3E%0A%3C%2Fsvg%3E");
}
"
`;
exports[`loader should compile data-uri function: errors 1`] = `[]`;
exports[`loader should compile data-uri function: warnings 1`] = `[]`;
exports[`loader should emit an error: errors 1`] = `
[
"ModuleBuildError: Module build failed (from \`replaced original path\`):
",
]
`;
exports[`loader should emit an error: warnings 1`] = `[]`;
exports[`loader should get absolute path relative rootContext: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should get absolute path relative rootContext: errors 1`] = `[]`;
exports[`loader should get absolute path relative rootContext: warnings 1`] = `[]`;
exports[`loader should import from glob expressions: css 1`] = `
".a {
color: red;
}
"
`;
exports[`loader should import from glob expressions: errors 1`] = `[]`;
exports[`loader should import from glob expressions: warnings 1`] = `[]`;
exports[`loader should import from plugins: css 1`] = `
".imported-class {
color: coral;
}
"
`;
exports[`loader should import from plugins: errors 1`] = `[]`;
exports[`loader should import from plugins: warnings 1`] = `[]`;
exports[`loader should install plugins: errors 1`] = `[]`;
exports[`loader should install plugins: warnings 1`] = `[]`;
exports[`loader should not alter the original options object: errors 1`] = `[]`;
exports[`loader should not alter the original options object: warnings 1`] = `[]`;
exports[`loader should not to disable webpack's resolver by passing an empty paths array: css 1`] = `
".img {
background: url(some/img.jpg);
}
.img2 {
background: url(../img.jpg);
}
.box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
body {
background: url(assets/resources/circle.svg);
}
.abs {
background: url(assets/resources/circle.svg);
}
"
`;
exports[`loader should not to disable webpack's resolver by passing an empty paths array: errors 1`] = `[]`;
exports[`loader should not to disable webpack's resolver by passing an empty paths array: warnings 1`] = `[]`;
exports[`loader should not try to resolve CSS imports with URLs: css 1`] = `
"@import url("http://fonts.googleapis.com/css?family=Roboto:300,400,500");
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500");
@import url("//fonts.googleapis.com/css?family=Roboto:300,400,500");
"
`;
exports[`loader should not try to resolve CSS imports with URLs: errors 1`] = `[]`;
exports[`loader should not try to resolve CSS imports with URLs: warnings 1`] = `[]`;
exports[`loader should prefer-relativee imports correctly: css 1`] = `
".prefer-relative-import {
background: red;
}
.relative {
color: coral;
}
"
`;
exports[`loader should prefer-relativee imports correctly: errors 1`] = `[]`;
exports[`loader should prefer-relativee imports correctly: warnings 1`] = `[]`;
exports[`loader should provide a useful error message if the import could not be found: errors 1`] = `
[
"ModuleBuildError: Module build failed (from \`replaced original path\`):
",
]
`;
exports[`loader should provide a useful error message if the import could not be found: warnings 1`] = `[]`;
exports[`loader should provide a useful error message if there was a syntax error: errors 1`] = `
[
"ModuleBuildError: Module build failed (from \`replaced original path\`):
",
]
`;
exports[`loader should provide a useful error message if there was a syntax error: warnings 1`] = `[]`;
exports[`loader should resolve "@import" with "css" extension: css 1`] = `
"@import "css.css";
"
`;
exports[`loader should resolve "@import" with "css" extension: errors 1`] = `[]`;
exports[`loader should resolve "@import" with "css" extension: warnings 1`] = `[]`;
exports[`loader should resolve "@import" with "less" extension: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should resolve "@import" with "less" extension: errors 1`] = `[]`;
exports[`loader should resolve "@import" with "less" extension: warnings 1`] = `[]`;
exports[`loader should resolve "@import" with "php" extension: css 1`] = `
"a {
color: red;
}
"
`;
exports[`loader should resolve "@import" with "php" extension: errors 1`] = `[]`;
exports[`loader should resolve "@import" with "php" extension: warnings 1`] = `[]`;
exports[`loader should resolve "@import" without "less" extension: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should resolve "@import" without "less" extension: errors 1`] = `[]`;
exports[`loader should resolve "@import" without "less" extension: warnings 1`] = `[]`;
exports[`loader should resolve absolute path with alias: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should resolve absolute path with alias: errors 1`] = `[]`;
exports[`loader should resolve absolute path with alias: warnings 1`] = `[]`;
exports[`loader should resolve absolute path: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should resolve absolute path: errors 1`] = `[]`;
exports[`loader should resolve absolute path: warnings 1`] = `[]`;
exports[`loader should resolve aliases in diffrent variants: css 1`] = `
".img {
background: url(some/img.jpg);
}
.img2 {
background: url(../img.jpg);
}
.box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
body {
background: url(assets/resources/circle.svg);
}
.abs {
background: url(assets/resources/circle.svg);
}
"
`;
exports[`loader should resolve aliases in diffrent variants: errors 1`] = `[]`;
exports[`loader should resolve aliases in diffrent variants: warnings 1`] = `[]`;
exports[`loader should resolve all imports from node_modules using webpack's resolver: css 1`] = `
"@import "some/css.css";
@import "some/css.css";
#it-works {
color: hotpink;
}
.modules-dir-some-module,
#it-works {
background: hotpink;
}
#it-works {
margin: 10px;
}
"
`;
exports[`loader should resolve all imports from node_modules using webpack's resolver: errors 1`] = `[]`;
exports[`loader should resolve all imports from node_modules using webpack's resolver: warnings 1`] = `[]`;
exports[`loader should resolve all imports from the given paths using Less resolver: css 1`] = `
".modules-dir-some-module {
color: hotpink;
}
"
`;
exports[`loader should resolve all imports from the given paths using Less resolver: errors 1`] = `[]`;
exports[`loader should resolve all imports from the given paths using Less resolver: warnings 1`] = `[]`;
exports[`loader should resolve all imports: css 1`] = `
"@import "css.css";
@import "css.css";
.classical-css,
#it-works {
background: hotpink;
}
.box,
#it-works {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
#it-works {
margin: 10px;
}
"
`;
exports[`loader should resolve all imports: errors 1`] = `[]`;
exports[`loader should resolve all imports: warnings 1`] = `[]`;
exports[`loader should resolve nested imports: css 1`] = `
".top-import {
background: red;
}
.nested-import {
background: coral;
}
"
`;
exports[`loader should resolve nested imports: errors 1`] = `[]`;
exports[`loader should resolve nested imports: warnings 1`] = `[]`;
exports[`loader should resolve non-less import with alias: css 1`] = `
".some-file {
background: hotpink;
}
"
`;
exports[`loader should resolve non-less import with alias: errors 1`] = `[]`;
exports[`loader should resolve non-less import with alias: warnings 1`] = `[]`;
exports[`loader should resolve the "less" field from the "exports" field from "package.json": css 1`] = `
".load-me {
color: red;
}
"
`;
exports[`loader should resolve the "less" field from the "exports" field from "package.json": errors 1`] = `[]`;
exports[`loader should resolve the "less" field from the "exports" field from "package.json": warnings 1`] = `[]`;
exports[`loader should resolve unresolved url with alias: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should resolve unresolved url with alias: errors 1`] = `[]`;
exports[`loader should resolve unresolved url with alias: warnings 1`] = `[]`;
exports[`loader should transform urls: css 1`] = `
".img4 {
background: url(folder/img.jpg);
}
.img5 {
background: url(folder/some/img.jpg);
}
.img6 {
background: url(./img.jpg);
}
.img1 {
background: url(img.jpg);
}
.img2 {
background: url(some/img.jpg);
}
.img3 {
background: url(../img.jpg);
}
"
`;
exports[`loader should transform urls: errors 1`] = `[]`;
exports[`loader should transform urls: warnings 1`] = `[]`;
exports[`loader should watch imports correctly: css 1`] = `
"a {
color: red;
}
"
`;
exports[`loader should watch imports correctly: errors 1`] = `[]`;
exports[`loader should watch imports correctly: warnings 1`] = `[]`;
exports[`loader should work and have loaderContext in less plugins: css 1`] = `
".webpackLoaderContext {
isDefined: true;
}
"
`;
exports[`loader should work and have loaderContext in less plugins: errors 1`] = `[]`;
exports[`loader should work and have loaderContext in less plugins: warnings 1`] = `[]`;
exports[`loader should work and logging: css 1`] = `
"nav ul {
background: blue;
}
"
`;
exports[`loader should work and logging: errors 1`] = `[]`;
exports[`loader should work and logging: logs 1`] = `
[
[
{
"args": [
"extend ' .inline' has no matches",
],
"type": "warn",
},
{
"args": [
"The file undefined was skipped because it was not found and the import was marked optional.",
],
"type": "log",
},
],
]
`;
exports[`loader should work and logging: warnings 1`] = `[]`;
exports[`loader should work and respect the 'resolve.byDependecy.less' option: css 1`] = `
".a {
color: red;
}
.b {
color: red;
}
"
`;
exports[`loader should work and respect the 'resolve.byDependecy.less' option: errors 1`] = `[]`;
exports[`loader should work and respect the 'resolve.byDependecy.less' option: warnings 1`] = `[]`;
exports[`loader should work lessOptions.relativeUrls is false: css 1`] = `
".top-import {
background: red;
}
.img4 {
background: url(img.jpg);
}
.img5 {
background: url(some/img.jpg);
}
.img6 {
background: url(../img.jpg);
}
"
`;
exports[`loader should work lessOptions.relativeUrls is false: errors 1`] = `[]`;
exports[`loader should work lessOptions.relativeUrls is false: warnings 1`] = `[]`;
exports[`loader should work lessOptions.relativeUrls is true: css 1`] = `
".top-import {
background: red;
}
.img4 {
background: url(folder/img.jpg);
}
.img5 {
background: url(folder/some/img.jpg);
}
.img6 {
background: url(./img.jpg);
}
"
`;
exports[`loader should work lessOptions.relativeUrls is true: errors 1`] = `[]`;
exports[`loader should work lessOptions.relativeUrls is true: warnings 1`] = `[]`;
exports[`loader should work third-party plugins as fileLoader: css 1`] = `
".file-loader {
background: coral;
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: url(https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmEU9fBBc9.ttf) format('truetype');
}
.modules-dir-scope-module {
color: hotpink;
}
"
`;
exports[`loader should work third-party plugins as fileLoader: errors 1`] = `[]`;
exports[`loader should work third-party plugins as fileLoader: warnings 1`] = `[]`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): css 1`] = `
".load-me {
color: red;
}
"
`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): errors 1`] = `[]`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): warnings 1`] = `[]`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): css 1`] = `
".load-me {
color: blue;
}
"
`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): errors 1`] = `[]`;
exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): warnings 1`] = `[]`;
exports[`loader should work: css 1`] = `
".box {
color: #fe33ac;
border-color: #fdcdea;
background: url(box.png);
}
.box div {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
"
`;
exports[`loader should work: errors 1`] = `[]`;
exports[`loader should work: warnings 1`] = `[]`;