@@ -2,18 +2,19 @@ import * as path from 'node:path';
22import { assert , describe , it } from 'vitest' ;
33
44import { ResolverFactory } from '../index.js' ;
5+ import { normalizePath } from './utils.mjs' ;
56
6- const fixtureDir = new URL (
7+ const fixtureDir = path . resolve (
8+ import . meta. dirname ,
79 '../../fixtures/enhanced_resolve/test/fixtures' ,
8- import . meta. url ,
9- ) . pathname ;
10+ ) ;
1011
1112describe ( 'option' , ( ) => {
1213 describe ( 'aliasFields' , ( ) => {
1314 it ( 'should allow field string ' , ( ) => {
1415 const resolver = new ResolverFactory ( { aliasFields : [ 'browser' ] } ) ;
1516 assert . match (
16- resolver . sync ( fixtureDir , './browser-module/lib/replaced.js' ) . path ,
17+ normalizePath ( resolver . sync ( fixtureDir , './browser-module/lib/replaced.js' ) . path ) ,
1718 / b r o w s e r - m o d u l e \/ l i b \/ b r o w s e r \. j s $ / ,
1819 ) ;
1920 } ) ;
@@ -23,7 +24,7 @@ describe('option', () => {
2324 } ) ;
2425
2526 assert . match (
26- resolver . sync ( fixtureDir , './browser-module/lib/main1.js' ) . path ,
27+ normalizePath ( resolver . sync ( fixtureDir , './browser-module/lib/main1.js' ) . path ) ,
2728 / b r o w s e r - m o d u l e \/ l i b \/ m a i n \. j s $ / ,
2829 ) ;
2930 } ) ;
@@ -33,10 +34,12 @@ describe('option', () => {
3334 const createTest = ( exportsFields ) => {
3435 const resolver = new ResolverFactory ( { exportsFields } ) ;
3536 assert . match (
36- resolver . sync (
37- path . resolve ( fixtureDir , './exports-field3' ) ,
38- 'exports-field' ,
39- ) . path ,
37+ normalizePath (
38+ resolver . sync (
39+ path . resolve ( fixtureDir , './exports-field3' ) ,
40+ 'exports-field' ,
41+ ) . path ,
42+ ) ,
4043 / \/ e x p o r t s - f i e l d \/ s r c \/ i n d e x \. j s $ / ,
4144 ) ;
4245 } ;
@@ -48,7 +51,7 @@ describe('option', () => {
4851 const createTest = ( mainFields ) => {
4952 const resolver = new ResolverFactory ( { mainFields } ) ;
5053 assert . match (
51- resolver . sync ( fixtureDir , '../..' ) . path ,
54+ normalizePath ( resolver . sync ( fixtureDir , '../..' ) . path ) ,
5255 / \/ l i b \/ i n d e x \. j s $ / ,
5356 ) ;
5457 } ;
0 commit comments