diff options
Diffstat (limited to 'test/parallel/test-fs-close-errors.js')
-rw-r--r-- | test/parallel/test-fs-close-errors.js | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/test/parallel/test-fs-close-errors.js b/test/parallel/test-fs-close-errors.js index f81d96c056..3be8b4ce33 100644 --- a/test/parallel/test-fs-close-errors.js +++ b/test/parallel/test-fs-close-errors.js @@ -3,24 +3,16 @@ // This tests that the errors thrown from fs.close and fs.closeSync // include the desired properties -const common = require('../common'); +require('../common'); +const assert = require('assert'); const fs = require('fs'); -['', false, null, undefined, {}, []].forEach((i) => { - common.expectsError( - () => fs.close(i), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "fd" argument must be of type integer' - } - ); - common.expectsError( - () => fs.closeSync(i), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "fd" argument must be of type integer' - } - ); +['', false, null, undefined, {}, []].forEach((input) => { + const errObj = { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError [ERR_INVALID_ARG_TYPE]', + message: 'The "fd" argument must be of type integer' + }; + assert.throws(() => fs.close(input), errObj); + assert.throws(() => fs.closeSync(input), errObj); }); |