@@ -5,6 +5,7 @@ import { URL, fileURLToPath } from 'url'
5
5
import { Settings } from '@tailwindcss/language-service/src/util/state'
6
6
import { createResolver } from './resolver'
7
7
import { css , defineTest , js , json , scss , Storage , TestUtils } from './testing'
8
+ import { normalizePath } from './utils'
8
9
9
10
let settings : Settings = {
10
11
tailwindCSS : {
@@ -29,12 +30,14 @@ function testFixture(fixture: string, details: any[]) {
29
30
30
31
let detail = details [ i ]
31
32
32
- let configPath = path . relative ( fixturePath , project . config . path )
33
+ let configPath = path . relative ( normalizePath ( fixturePath ) , project . config . path )
33
34
34
35
expect ( configPath ) . toEqual ( detail ?. config )
35
36
36
37
if ( detail ?. content ) {
37
- let expected = detail ?. content . map ( ( path ) => path . replace ( '{URL}' , fixturePath ) ) . sort ( )
38
+ let expected = detail ?. content
39
+ . map ( ( path ) => path . replace ( '{URL}' , normalizePath ( fixturePath ) ) )
40
+ . sort ( )
38
41
39
42
let actual = project . documentSelector
40
43
. filter ( ( selector ) => selector . priority === 1 /** content */ )
@@ -45,7 +48,9 @@ function testFixture(fixture: string, details: any[]) {
45
48
}
46
49
47
50
if ( detail ?. selectors ) {
48
- let expected = detail ?. selectors . map ( ( path ) => path . replace ( '{URL}' , fixturePath ) ) . sort ( )
51
+ let expected = detail ?. selectors
52
+ . map ( ( path ) => path . replace ( '{URL}' , normalizePath ( fixturePath ) ) )
53
+ . sort ( )
49
54
50
55
let actual = project . documentSelector . map ( ( selector ) => selector . pattern ) . sort ( )
51
56
@@ -364,7 +369,7 @@ async function prepare({ root }: TestUtils) {
364
369
} as Settings
365
370
366
371
function adjustPath ( filepath : string ) {
367
- filepath = filepath . replace ( root , '{URL}' )
372
+ filepath = filepath . replace ( normalizePath ( root ) , '{URL}' )
368
373
369
374
if ( filepath . startsWith ( '{URL}/' ) ) {
370
375
filepath = filepath . slice ( 5 )
0 commit comments