From e98a900c59e7a66df09f124b5ee12142e0632564 Mon Sep 17 00:00:00 2001 From: Josef Spiteri Date: Wed, 6 Nov 2024 16:19:11 +0000 Subject: [PATCH 1/3] test: file read no exist update to test runner --- test/parallel/test-file-read-noexist.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-file-read-noexist.js b/test/parallel/test-file-read-noexist.js index 7293113f22a1a0..08af7ffb82c6e9 100644 --- a/test/parallel/test-file-read-noexist.js +++ b/test/parallel/test-file-read-noexist.js @@ -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(); + }); + }); +}); From 8b0155ceee98e91a102d2fdc50b666b53d908aee Mon Sep 17 00:00:00 2001 From: Josef Spiteri Date: Sat, 7 Dec 2024 16:00:37 +0100 Subject: [PATCH 2/3] test: re-add common mustcall --- test/parallel/test-file-read-noexist.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-file-read-noexist.js b/test/parallel/test-file-read-noexist.js index 08af7ffb82c6e9..7b8322b988a4dc 100644 --- a/test/parallel/test-file-read-noexist.js +++ b/test/parallel/test-file-read-noexist.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); const fs = require('fs'); @@ -29,10 +29,10 @@ const { describe, it } = require('node:test'); 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, _) { + fs.readFile(filename, 'latin1', common.mustCall(function (err, _) { assert.ok(err); assert.strictEqual(err.code, 'ENOENT'); done(); - }); + })); }); }); From 852ccdb43f22460b2b847e112a4601b430db5791 Mon Sep 17 00:00:00 2001 From: Josef Spiteri Date: Wed, 19 Mar 2025 21:56:34 +0100 Subject: [PATCH 3/3] fix: linting error --- test/parallel/test-file-read-noexist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-file-read-noexist.js b/test/parallel/test-file-read-noexist.js index 7b8322b988a4dc..775781c7eea97a 100644 --- a/test/parallel/test-file-read-noexist.js +++ b/test/parallel/test-file-read-noexist.js @@ -29,7 +29,7 @@ const { describe, it } = require('node:test'); 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', common.mustCall(function (err, _) { + fs.readFile(filename, 'latin1', common.mustCall(function(err, _) { assert.ok(err); assert.strictEqual(err.code, 'ENOENT'); done();