@@ -7,24 +7,23 @@ const path = require('path');
77
88tmpdir . refresh ( ) ;
99
10+ const code = common . isWindows ? 'ENOENT' : 'ENOTDIR' ;
11+
1012{
1113 const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
1214 fs . writeFileSync ( filePath , '' ) ;
13- assert . throws ( ( ) => fs . rmdirSync ( filePath , { recursive : true } ) , {
14- code : 'ENOTDIR' ,
15- } ) ;
15+ assert . throws ( ( ) => fs . rmdirSync ( filePath , { recursive : true } ) , { code } ) ;
1616}
1717{
1818 const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
1919 fs . writeFileSync ( filePath , '' ) ;
2020 fs . rmdir ( filePath , { recursive : true } , common . mustCall ( ( err ) => {
21- assert . strictEqual ( err . code , 'ENOTDIR' ) ;
21+ assert . strictEqual ( err . code , code ) ;
2222 } ) ) ;
2323}
2424{
2525 const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
2626 fs . writeFileSync ( filePath , '' ) ;
27- assert . rejects ( ( ) => fs . promises . rmdir ( filePath , { recursive : true } ) , {
28- code : 'ENOTDIR' ,
29- } ) . then ( common . mustCall ( ) ) ;
27+ assert . rejects ( ( ) => fs . promises . rmdir ( filePath , { recursive : true } ) ,
28+ { code } ) . then ( common . mustCall ( ) ) ;
3029}
0 commit comments