@@ -7,24 +7,23 @@ const path = require('path');
7
7
8
8
tmpdir . refresh ( ) ;
9
9
10
+ const code = common . isWindows ? 'ENOENT' : 'ENOTDIR' ;
11
+
10
12
{
11
13
const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
12
14
fs . writeFileSync ( filePath , '' ) ;
13
- assert . throws ( ( ) => fs . rmdirSync ( filePath , { recursive : true } ) , {
14
- code : 'ENOTDIR' ,
15
- } ) ;
15
+ assert . throws ( ( ) => fs . rmdirSync ( filePath , { recursive : true } ) , { code } ) ;
16
16
}
17
17
{
18
18
const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
19
19
fs . writeFileSync ( filePath , '' ) ;
20
20
fs . rmdir ( filePath , { recursive : true } , common . mustCall ( ( err ) => {
21
- assert . strictEqual ( err . code , 'ENOTDIR' ) ;
21
+ assert . strictEqual ( err . code , code ) ;
22
22
} ) ) ;
23
23
}
24
24
{
25
25
const filePath = path . join ( tmpdir . path , 'rmdir-recursive.txt' ) ;
26
26
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 ( ) ) ;
30
29
}
0 commit comments