@@ -19,7 +19,11 @@ test('realpathSync: should resolve to absolute path', (t) => {
1919test ( 'realpathSync: should match node:fs realpathSync' , ( t ) => {
2020 const nodeResult = nodeFs . realpathSync ( '.' )
2121 const hyperResult = realpathSync ( '.' )
22- t . is ( hyperResult , nodeResult )
22+ if ( process . platform === 'win32' ) {
23+ t . is ( nodeFs . realpathSync ( hyperResult ) , nodeFs . realpathSync ( nodeResult ) )
24+ } else {
25+ t . is ( hyperResult , nodeResult )
26+ }
2327} )
2428
2529test ( 'realpathSync: should throw on non-existent path' , ( t ) => {
@@ -44,17 +48,24 @@ test('dual-run: realpathSync should resolve symlink to real path', (t) => {
4448
4549 const nodeResult = nodeFs . realpathSync ( link )
4650 const hyperResult = realpathSync ( link )
47- // Compare against node:fs (not raw `target`): on macOS /tmp is a symlink to /private/tmp,
48- // so realpath resolves through it.
49- t . is ( hyperResult , nodeResult )
50- // The resolved path should end with the target filename
51+ if ( process . platform === 'win32' ) {
52+ const nodeHyper = nodeFs . statSync ( hyperResult )
53+ const nodeNode = nodeFs . statSync ( nodeResult )
54+ t . true ( nodeHyper . ino === nodeNode . ino && nodeHyper . dev === nodeNode . dev , 'same file' )
55+ } else {
56+ t . is ( hyperResult , nodeResult )
57+ }
5158 t . true ( hyperResult . endsWith ( 'real-target.txt' ) )
5259} )
5360
5461test ( 'dual-run: realpathSync should resolve relative path same as node:fs' , ( t ) => {
5562 const nodeResult = nodeFs . realpathSync ( 'src' )
5663 const hyperResult = realpathSync ( 'src' )
57- t . is ( hyperResult , nodeResult )
64+ if ( process . platform === 'win32' ) {
65+ t . is ( nodeFs . realpathSync ( hyperResult ) , nodeFs . realpathSync ( nodeResult ) )
66+ } else {
67+ t . is ( hyperResult , nodeResult )
68+ }
5869} )
5970
6071test ( 'realpath: async dual-run should resolve symlink same as node:fs' , async ( t ) => {
@@ -66,5 +77,11 @@ test('realpath: async dual-run should resolve symlink same as node:fs', async (t
6677
6778 const nodeResult = nodeFs . realpathSync ( link )
6879 const hyperResult = await realpath ( link )
69- t . is ( hyperResult , nodeResult )
80+ if ( process . platform === 'win32' ) {
81+ const nodeHyper = nodeFs . statSync ( hyperResult )
82+ const nodeNode = nodeFs . statSync ( nodeResult )
83+ t . true ( nodeHyper . ino === nodeNode . ino && nodeHyper . dev === nodeNode . dev , 'same file' )
84+ } else {
85+ t . is ( hyperResult , nodeResult )
86+ }
7087} )
0 commit comments