Skip to content

Commit

Permalink
test: nodejs v14+ silently ignores closing closed file descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Mar 13, 2021
1 parent 56da173 commit afb1873
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/lib/fs.open-close.spec.js
Expand Up @@ -6,6 +6,7 @@ const mock = require('../../lib/index');

const assert = helper.assert;
const withPromise = helper.withPromise;
const inVersion = helper.inVersion;

describe('fs.open(path, flags, [mode], callback)', function() {
beforeEach(function() {
Expand Down Expand Up @@ -220,11 +221,12 @@ describe('fs.close(fd, callback)', function() {
});
});

withPromise.it('promise fails for closed file descriptors', function(done) {
inVersion('>=10.0.0 <14.0.0').it('promise fails for closed file descriptors', function(done) {
fs.promises
.open('dir/file.txt', 'w')
.then(function(fd) {
return fd.close().then(function() {
// in Nodejs v14+, closing on closed file descriptor is silently ignored.
return fd.close();
});
})
Expand Down

0 comments on commit afb1873

Please sign in to comment.