From 56800c3fd71201334be86082ce25c9c253705e96 Mon Sep 17 00:00:00 2001 From: Markus Muschol Date: Tue, 7 Nov 2023 16:08:50 +0100 Subject: [PATCH] test: replaced foreach with for --- test/parallel/test-path.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 7a5f3d4715a7f2..7b2acab9937aca 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -30,13 +30,16 @@ const typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN]; function fail(fn) { const args = Array.from(arguments).slice(1); - assert.throws(() => { - fn.apply(null, args); - }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); + assert.throws( + () => { + fn.apply(null, args); + }, + { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' } + ); } -typeErrorTests.forEach((test) => { - [path.posix, path.win32].forEach((namespace) => { +for (const test of typeErrorTests) { + for (const namespace of [path.posix, path.win32]) { fail(namespace.join, test); fail(namespace.resolve, test); fail(namespace.normalize, test); @@ -52,8 +55,8 @@ typeErrorTests.forEach((test) => { if (test !== undefined) { fail(namespace.basename, 'foo', test); } - }); -}); + } +} // path.sep tests // windows @@ -67,7 +70,5 @@ assert.strictEqual(path.win32.delimiter, ';'); // posix assert.strictEqual(path.posix.delimiter, ':'); -if (common.isWindows) - assert.strictEqual(path, path.win32); -else - assert.strictEqual(path, path.posix); +if (common.isWindows) assert.strictEqual(path, path.win32); +else assert.strictEqual(path, path.posix);