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 11'use strict' ;
22const 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 ;
57
6- var caughtException = false ;
78try {
89 // should throw ENOENT, not EBADF
910 // see https://github.com/joyent/node/pull/1228
1011 fs . openSync ( '/path/to/file/that/does/not/exist' , 'r' ) ;
1112} catch ( e ) {
12- assert . equal ( e . code , 'ENOENT' ) ;
13+ assert . strictEqual ( e . code , 'ENOENT' ) ;
1314 caughtException = true ;
1415}
15- assert . ok ( caughtException ) ;
16+ assert . strictEqual ( caughtException , true ) ;
1617
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 ) ;
2120} ) ) ;
2221
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 ) ;
2724} ) ) ;
You can’t perform that action at this time.
0 commit comments