@@ -19,7 +19,7 @@ function tests(run: Run, version: number) {
1919 test ( 'default' , async function ( { expect } ) {
2020 const result = await run ( [ ...COMMON_CANDIDATES , 'ph' , 'ph-[info]' ] ) ;
2121 await expect ( result ) . toMatchFileSnapshot (
22- path . resolve ( __dirname , '__snapshots__' , `v${ version } /default.css` ) ,
22+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /default.css` ) ,
2323 ) ;
2424 } ) ;
2525
@@ -28,7 +28,7 @@ function tests(run: Run, version: number) {
2828 prefix : 'i' ,
2929 } ) ;
3030 await expect ( result ) . toMatchFileSnapshot (
31- path . resolve ( __dirname , '__snapshots__' , `v${ version } /custom-prefix.css` ) ,
31+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /custom-prefix.css` ) ,
3232 ) ;
3333 } ) ;
3434
@@ -37,7 +37,7 @@ function tests(run: Run, version: number) {
3737 layer : null ,
3838 } ) ;
3939 await expect ( result ) . toMatchFileSnapshot (
40- path . resolve ( __dirname , '__snapshots__' , `v${ version } /no-layer.css` ) ,
40+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /no-layer.css` ) ,
4141 ) ;
4242 } ) ;
4343
@@ -46,7 +46,7 @@ function tests(run: Run, version: number) {
4646 layer : 'custom' ,
4747 } ) ;
4848 await expect ( result ) . toMatchFileSnapshot (
49- path . resolve ( __dirname , '__snapshots__' , `v${ version } /custom-layer.css` ) ,
49+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /custom-layer.css` ) ,
5050 ) ;
5151 } ) ;
5252
@@ -55,7 +55,7 @@ function tests(run: Run, version: number) {
5555 'custom-property' : '--icon-url' ,
5656 } ) ;
5757 await expect ( result ) . toMatchFileSnapshot (
58- path . resolve ( __dirname , '__snapshots__' , `v${ version } /custom-property.css` ) ,
58+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /custom-property.css` ) ,
5959 ) ;
6060 } ) ;
6161
@@ -64,21 +64,21 @@ function tests(run: Run, version: number) {
6464 customProperty : '--icon-url' ,
6565 } ) ;
6666 await expect ( result ) . toMatchFileSnapshot (
67- path . resolve ( __dirname , '__snapshots__' , `v${ version } /custom-property.css` ) ,
67+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /custom-property.css` ) ,
6868 ) ;
6969 } ) ;
7070
7171 test ( 'no icon found' , async function ( ) {
7272 const result = await run ( [ ...COMMON_CANDIDATES , 'ph' , 'ph-[404]' ] ) ;
7373 await expect ( result ) . toMatchFileSnapshot (
74- path . resolve ( __dirname , '__snapshots__' , `v${ version } /no-icon-found.css` ) ,
74+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /no-icon-found.css` ) ,
7575 ) ;
7676 } ) ;
7777
7878 test ( 'no icon name' , async function ( ) {
7979 const result = await run ( [ ...COMMON_CANDIDATES , 'ph' , 'ph-[]' ] ) ;
8080 await expect ( result ) . toMatchFileSnapshot (
81- path . resolve ( __dirname , '__snapshots__' , `v${ version } /no-icon-name.css` ) ,
81+ path . resolve ( import . meta . dirname , '__snapshots__' , `v${ version } /no-icon-name.css` ) ,
8282 ) ;
8383 } ) ;
8484
@@ -87,7 +87,7 @@ function tests(run: Run, version: number) {
8787 test ( `weight:${ weight } ` , async function ( ) {
8888 const result = await run ( [ ...COMMON_CANDIDATES , 'ph' , `ph-[info--${ weight } ]` ] ) ;
8989 await expect ( result ) . toMatchFileSnapshot (
90- path . resolve ( __dirname , `__snapshots__` , `v${ version } /weight-${ weight } .css` ) ,
90+ path . resolve ( import . meta . dirname , `__snapshots__` , `v${ version } /weight-${ weight } .css` ) ,
9191 ) ;
9292 } ) ;
9393 }
@@ -107,8 +107,6 @@ describe('v4', function () {
107107 @tailwind utilities;
108108 }
109109 ` ;
110- const { currentTestName } = expect . getState ( ) ;
111-
112110 let cssPlugin = css `
113111 @plugin 'phosphor-icons-tailwindcss';
114112 ` ;
@@ -123,9 +121,8 @@ describe('v4', function () {
123121 };
124122 ` ;
125123 }
126-
127124 const { build } = await compile ( cssEntry + cssPlugin , {
128- base : `${ path . resolve ( __filename ) } ?test= ${ currentTestName } ` ,
125+ base : `${ path . resolve ( import . meta . url , '..' ) } ` ,
129126 onDependency : ( ) => { } ,
130127 shouldRewriteUrls : true ,
131128 ...( {
@@ -156,7 +153,7 @@ describe('v3', async function () {
156153 } satisfies import ( 'tailwindcssv3' ) . Config ;
157154
158155 const { css } = await postcss ( tailwindcss ( config ) ) . process ( cssEntry , {
159- from : `${ path . resolve ( __filename ) } ?test=${ currentTestName } ` ,
156+ from : `${ path . resolve ( import . meta . url ) } ?test=${ currentTestName } ` ,
160157 } ) ;
161158 return css ;
162159 } ;
0 commit comments