@@ -39,6 +39,10 @@ async function inProduction(callback) {
39
39
return result
40
40
}
41
41
42
+ function withTestName ( path ) {
43
+ return `${ path } ?test=${ expect . getState ( ) . currentTestName } `
44
+ }
45
+
42
46
const config = {
43
47
...defaultConfig ,
44
48
...customConfig ,
@@ -93,22 +97,22 @@ test('purges unused classes', () => {
93
97
purge : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] ,
94
98
} ) ,
95
99
] )
96
- . process ( input , { from : inputPath } )
100
+ . process ( input , { from : withTestName ( inputPath ) } )
97
101
. then ( ( result ) => {
98
102
assertPurged ( result )
99
103
} )
100
104
} )
101
105
)
102
106
} )
103
107
104
- test . skip ( 'purge patterns are resolved relative to the config file' , ( ) => {
108
+ test ( 'purge patterns are resolved relative to the config file' , ( ) => {
105
109
return inProduction (
106
110
suppressConsoleLogs ( ( ) => {
107
111
const inputPath = path . resolve ( `${ __dirname } /fixtures/tailwind-input.css` )
108
112
const input = fs . readFileSync ( inputPath , 'utf8' )
109
113
110
114
return postcss ( [ tailwind ( path . resolve ( `${ __dirname } /fixtures/custom-purge-config.js` ) ) ] )
111
- . process ( input , { from : inputPath } )
115
+ . process ( input , { from : withTestName ( inputPath ) } )
112
116
. then ( ( result ) => {
113
117
assertPurged ( result )
114
118
} )
@@ -275,7 +279,7 @@ test('purges unused classes with important string', () => {
275
279
purge : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] ,
276
280
} ) ,
277
281
] )
278
- . process ( input , { from : inputPath } )
282
+ . process ( input , { from : withTestName ( inputPath ) } )
279
283
. then ( ( result ) => {
280
284
assertPurged ( result )
281
285
} )
@@ -298,7 +302,7 @@ test('mode must be a valid value', () => {
298
302
content : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] ,
299
303
} ,
300
304
} ) ,
301
- ] ) . process ( input , { from : inputPath } )
305
+ ] ) . process ( input , { from : withTestName ( inputPath ) } )
302
306
) . rejects . toThrow ( )
303
307
} )
304
308
)
@@ -319,7 +323,7 @@ test('components are purged by default in layers mode', () => {
319
323
purge : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] ,
320
324
} ) ,
321
325
] )
322
- . process ( input , { from : inputPath } )
326
+ . process ( input , { from : withTestName ( inputPath ) } )
323
327
. then ( ( result ) => {
324
328
expect ( result . css ) . not . toContain ( '.container' )
325
329
assertPurged ( result )
@@ -347,7 +351,7 @@ test('you can specify which layers to purge', () => {
347
351
} ,
348
352
} ) ,
349
353
] )
350
- . process ( input , { from : inputPath } )
354
+ . process ( input , { from : withTestName ( inputPath ) } )
351
355
. then ( ( result ) => {
352
356
const rules = extractRules ( result . root )
353
357
expect ( rules ) . toContain ( 'optgroup' )
@@ -377,7 +381,7 @@ test('you can purge just base and component layers (but why)', () => {
377
381
} ,
378
382
} ) ,
379
383
] )
380
- . process ( input , { from : inputPath } )
384
+ . process ( input , { from : withTestName ( inputPath ) } )
381
385
. then ( ( result ) => {
382
386
const rules = extractRules ( result . root )
383
387
expect ( rules ) . not . toContain ( '[type="checkbox"]' )
@@ -439,7 +443,7 @@ test(
439
443
purge : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] ,
440
444
} ) ,
441
445
] )
442
- . process ( input , { from : inputPath } )
446
+ . process ( input , { from : withTestName ( inputPath ) } )
443
447
. then ( ( result ) => {
444
448
const expected = fs . readFileSync (
445
449
path . resolve ( `${ __dirname } /fixtures/tailwind-output.css` ) ,
@@ -465,7 +469,7 @@ test('does not purge if the array is empty', () => {
465
469
purge : [ ] ,
466
470
} ) ,
467
471
] )
468
- . process ( input , { from : inputPath } )
472
+ . process ( input , { from : withTestName ( inputPath ) } )
469
473
. then ( ( result ) => {
470
474
process . env . NODE_ENV = OLD_NODE_ENV
471
475
const expected = fs . readFileSync (
@@ -491,7 +495,7 @@ test('does not purge if explicitly disabled', () => {
491
495
purge : { enabled : false } ,
492
496
} ) ,
493
497
] )
494
- . process ( input , { from : inputPath } )
498
+ . process ( input , { from : withTestName ( inputPath ) } )
495
499
. then ( ( result ) => {
496
500
const expected = fs . readFileSync (
497
501
path . resolve ( `${ __dirname } /fixtures/tailwind-output.css` ) ,
@@ -516,7 +520,7 @@ test('does not purge if purge is simply false', () => {
516
520
purge : false ,
517
521
} ) ,
518
522
] )
519
- . process ( input , { from : inputPath } )
523
+ . process ( input , { from : withTestName ( inputPath ) } )
520
524
. then ( ( result ) => {
521
525
const expected = fs . readFileSync (
522
526
path . resolve ( `${ __dirname } /fixtures/tailwind-output.css` ) ,
@@ -541,7 +545,7 @@ test('purges outside of production if explicitly enabled', () => {
541
545
purge : { enabled : true , content : [ path . resolve ( `${ __dirname } /fixtures/**/*.html` ) ] } ,
542
546
} ) ,
543
547
] )
544
- . process ( input , { from : inputPath } )
548
+ . process ( input , { from : withTestName ( inputPath ) } )
545
549
. then ( ( result ) => {
546
550
assertPurged ( result )
547
551
} )
@@ -567,7 +571,7 @@ test(
567
571
} ,
568
572
} ) ,
569
573
] )
570
- . process ( input , { from : inputPath } )
574
+ . process ( input , { from : withTestName ( inputPath ) } )
571
575
. then ( ( result ) => {
572
576
expect ( result . css ) . toContain ( '.md\\:bg-green-500' )
573
577
assertPurged ( result )
@@ -596,7 +600,7 @@ test(
596
600
css . walkComments ( ( c ) => c . remove ( ) )
597
601
} ,
598
602
] )
599
- . process ( input , { from : inputPath } )
603
+ . process ( input , { from : withTestName ( inputPath ) } )
600
604
. then ( ( result ) => {
601
605
expect ( result . css ) . toContain ( 'html' )
602
606
expect ( result . css ) . toContain ( 'body' )
@@ -624,7 +628,7 @@ test('element selectors are preserved by default', () => {
624
628
} ,
625
629
} ) ,
626
630
] )
627
- . process ( input , { from : inputPath } )
631
+ . process ( input , { from : withTestName ( inputPath ) } )
628
632
. then ( ( result ) => {
629
633
const rules = extractRules ( result . root )
630
634
; [
@@ -678,7 +682,7 @@ test('element selectors are preserved even when defaultExtractor is overridden',
678
682
} ,
679
683
} ) ,
680
684
] )
681
- . process ( input , { from : inputPath } )
685
+ . process ( input , { from : withTestName ( inputPath ) } )
682
686
. then ( ( result ) => {
683
687
const rules = extractRules ( result . root )
684
688
; [
@@ -729,7 +733,7 @@ test('preserving element selectors can be disabled', () => {
729
733
} ,
730
734
} ) ,
731
735
] )
732
- . process ( input , { from : inputPath } )
736
+ . process ( input , { from : withTestName ( inputPath ) } )
733
737
. then ( ( result ) => {
734
738
const rules = extractRules ( result . root )
735
739
0 commit comments