test: file read no exist update to test runner

This commit is contained in:
Josef Spiteri 2024-11-06 16:19:11 +00:00
parent 6f12f1e500
commit e98a900c59
1 changed files with 13 additions and 7 deletions

View File

@ -20,13 +20,19 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');
const fs = require('fs');
const { describe, it } = require('node:test');
const filename = fixtures.path('does_not_exist.txt');
fs.readFile(filename, 'latin1', common.mustCall(function(err, content) {
assert.ok(err);
assert.strictEqual(err.code, 'ENOENT');
}));
describe('fs.readfile', () => {
it('should return ENOENT error code for non existing file', (_, done) => {
const filename = fixtures.path('does_not_exist.txt');
fs.readFile(filename, 'latin1', function(err, _) {
assert.ok(err);
assert.strictEqual(err.code, 'ENOENT');
done();
});
});
});