@@ -191,21 +191,25 @@ function test_cyclic_link_protection(callback) {
191
191
common . skip ( 'symlink test (no privs)' ) ;
192
192
return runNextTest ( ) ;
193
193
}
194
- const entry = common . tmpDir + '/cycles/realpath-3a' ;
194
+ const entry = path . join ( common . tmpDir , '/cycles/realpath-3a' ) ;
195
195
[
196
196
[ 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' ]
199
199
] . forEach ( function ( t ) {
200
200
try { fs . unlinkSync ( t [ 0 ] ) ; } catch ( e ) { }
201
201
fs . symlinkSync ( t [ 1 ] , t [ 0 ] , 'dir' ) ;
202
202
unlink . push ( t [ 0 ] ) ;
203
203
} ) ;
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
+ } ) ) ;
209
213
}
210
214
211
215
function test_cyclic_link_overprotection ( callback ) {
0 commit comments