@@ -191,21 +191,25 @@ function test_cyclic_link_protection(callback) {
191191 common . skip ( 'symlink test (no privs)' ) ;
192192 return runNextTest ( ) ;
193193 }
194- const entry = common . tmpDir + '/cycles/realpath-3a' ;
194+ const entry = path . join ( common . tmpDir , '/cycles/realpath-3a' ) ;
195195 [
196196 [ entry , '../cycles/realpath-3b' ] ,
197- [ common . tmpDir + '/cycles/realpath-3b' , '../cycles/realpath-3c' ] ,
198- [ common . tmpDir + '/cycles/realpath-3c' , '../cycles/realpath-3a' ]
197+ [ path . join ( common . tmpDir , '/cycles/realpath-3b' ) , '../cycles/realpath-3c' ] ,
198+ [ path . join ( common . tmpDir , '/cycles/realpath-3c' ) , '../cycles/realpath-3a' ]
199199 ] . forEach ( function ( t ) {
200200 try { fs . unlinkSync ( t [ 0 ] ) ; } catch ( e ) { }
201201 fs . symlinkSync ( t [ 1 ] , t [ 0 ] , 'dir' ) ;
202202 unlink . push ( t [ 0 ] ) ;
203203 } ) ;
204- assert . throws ( function ( ) { fs . realpathSync ( entry ) ; } ) ;
205- asynctest ( fs . realpath , [ entry ] , callback , function ( err , result ) {
206- assert . ok ( err && true ) ;
207- return true ;
208- } ) ;
204+ assert . throws ( ( ) => {
205+ fs . realpathSync ( entry ) ;
206+ } , common . expectsError ( { code : 'ELOOP' , type : Error } ) ) ;
207+ asynctest (
208+ fs . realpath , [ entry ] , callback , common . mustCall ( function ( err , result ) {
209+ assert . strictEqual ( err . path , entry ) ;
210+ assert . strictEqual ( result , undefined ) ;
211+ return true ;
212+ } ) ) ;
209213}
210214
211215function test_cyclic_link_overprotection ( callback ) {
0 commit comments