mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 01:27:14 +00:00

PR-URL: https://github.com/nodejs/node/pull/18864 Fixes: https://github.com/nodejs/node/issues/18820 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
27 lines
606 B
JavaScript
27 lines
606 B
JavaScript
'use strict';
|
|
|
|
// This tests that the errors thrown from fs.close and fs.closeSync
|
|
// include the desired properties
|
|
|
|
const common = require('../common');
|
|
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'
|
|
}
|
|
);
|
|
});
|