@@ -27,6 +27,7 @@ import {
2727 writeJson ,
2828 writeJsonSync ,
2929} from '../../registry/dist/lib/fs.js'
30+ import { normalizePath } from '../../registry/dist/lib/path.js'
3031import { trash } from '../../scripts/utils/fs.mjs'
3132
3233describe ( 'fs module' , ( ) => {
@@ -393,22 +394,22 @@ describe('fs module', () => {
393394 const filePath = path . join ( tmpDir , 'test.txt' )
394395 fs . writeFileSync ( filePath , 'content' )
395396 const result = uniqueSync ( filePath )
396- expect ( result ) . toBe ( path . join ( tmpDir , 'test-1.txt' ) )
397+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , 'test-1.txt' ) ) )
397398 } )
398399
399400 it ( 'should increment number for multiple conflicts' , ( ) => {
400401 const base = path . join ( tmpDir , 'test.txt' )
401402 fs . writeFileSync ( base , 'content' )
402403 fs . writeFileSync ( path . join ( tmpDir , 'test-1.txt' ) , 'content' )
403404 const result = uniqueSync ( base )
404- expect ( result ) . toBe ( path . join ( tmpDir , 'test-2.txt' ) )
405+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , 'test-2.txt' ) ) )
405406 } )
406407
407408 it ( 'should handle files with extensions' , ( ) => {
408409 const filePath = path . join ( tmpDir , 'file.json' )
409410 fs . writeFileSync ( filePath , '{}' )
410411 const result = uniqueSync ( filePath )
411- expect ( result ) . toBe ( path . join ( tmpDir , 'file-1.json' ) )
412+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , 'file-1.json' ) ) )
412413 } )
413414 } )
414415
@@ -417,15 +418,15 @@ describe('fs module', () => {
417418 const searchFile = 'target.txt'
418419 fs . writeFileSync ( path . join ( tmpDir , searchFile ) , 'found' )
419420 const result = findUpSync ( searchFile , { cwd : tmpDir } )
420- expect ( result ) . toBe ( path . join ( tmpDir , searchFile ) )
421+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , searchFile ) ) )
421422 } )
422423
423424 it ( 'should find file in parent directories' , ( ) => {
424425 const subDir = path . join ( tmpDir , 'sub' , 'dir' )
425426 fs . mkdirSync ( subDir , { recursive : true } )
426427 fs . writeFileSync ( path . join ( tmpDir , 'target.txt' ) , 'found' )
427428 const result = findUpSync ( 'target.txt' , { cwd : subDir } )
428- expect ( result ) . toBe ( path . join ( tmpDir , 'target.txt' ) )
429+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , 'target.txt' ) ) )
429430 } )
430431
431432 it ( 'should return undefined if not found' , ( ) => {
@@ -450,15 +451,15 @@ describe('fs module', () => {
450451 const searchFile = 'target.txt'
451452 fs . writeFileSync ( path . join ( tmpDir , searchFile ) , 'found' )
452453 const result = await findUp ( searchFile , { cwd : tmpDir } )
453- expect ( result ) . toBe ( path . join ( tmpDir , searchFile ) )
454+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , searchFile ) ) )
454455 } )
455456
456457 it ( 'should find file in parent directories' , async ( ) => {
457458 const subDir = path . join ( tmpDir , 'sub' , 'dir' )
458459 fs . mkdirSync ( subDir , { recursive : true } )
459460 fs . writeFileSync ( path . join ( tmpDir , 'target.txt' ) , 'found' )
460461 const result = await findUp ( 'target.txt' , { cwd : subDir } )
461- expect ( result ) . toBe ( path . join ( tmpDir , 'target.txt' ) )
462+ expect ( result ) . toBe ( normalizePath ( path . join ( tmpDir , 'target.txt' ) ) )
462463 } )
463464
464465 it ( 'should return undefined if not found' , async ( ) => {
0 commit comments