File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const common = require ( '../common' ) ;
3
- var assert = require ( 'assert' ) ;
4
- var fs = require ( 'fs' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const fs = require ( 'fs' ) ;
5
+
6
+ let caughtException = false ;
5
7
6
- var caughtException = false ;
7
8
try {
8
9
// should throw ENOENT, not EBADF
9
10
// see https://github.com/joyent/node/pull/1228
10
11
fs . openSync ( '/path/to/file/that/does/not/exist' , 'r' ) ;
11
12
} catch ( e ) {
12
- assert . equal ( e . code , 'ENOENT' ) ;
13
+ assert . strictEqual ( e . code , 'ENOENT' ) ;
13
14
caughtException = true ;
14
15
}
15
- assert . ok ( caughtException ) ;
16
+ assert . strictEqual ( caughtException , true ) ;
16
17
17
- fs . open ( __filename , 'r' , common . mustCall ( function ( err , fd ) {
18
- if ( err ) {
19
- throw err ;
20
- }
18
+ fs . open ( __filename , 'r' , common . mustCall ( ( err ) => {
19
+ assert . ifError ( err ) ;
21
20
} ) ) ;
22
21
23
- fs . open ( __filename , 'rs' , common . mustCall ( function ( err , fd ) {
24
- if ( err ) {
25
- throw err ;
26
- }
22
+ fs . open ( __filename , 'rs' , common . mustCall ( ( err ) => {
23
+ assert . ifError ( err ) ;
27
24
} ) ) ;
You can’t perform that action at this time.
0 commit comments