From a589de08864f6e9b6ecca47edadd4483806d2b88 Mon Sep 17 00:00:00 2001 From: Gibby Free <33621269+gibbyfree@users.noreply.github.com> Date: Sun, 12 May 2024 12:19:54 -0700 Subject: [PATCH] test: use `for-of` instead of `forEach` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/49790 Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Ruy Adorno Reviewed-By: Antoine du Hamel --- test/parallel/test-path-parse-format.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index 52acd836cce87b..e834031403034c 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -148,13 +148,11 @@ const trailingTests = [ ], ]; const failures = []; -trailingTests.forEach((test) => { - const parse = test[0]; +for (const [parse, testList] of trailingTests) { const os = parse === path.win32.parse ? 'win32' : 'posix'; - test[1].forEach((test) => { - const actual = parse(test[0]); - const expected = test[1]; - const message = `path.${os}.parse(${JSON.stringify(test[0])})\n expect=${ + for (const [input, expected] of testList) { + const actual = parse(input); + const message = `path.${os}.parse(${JSON.stringify(input)})\n expect=${ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; const actualKeys = Object.keys(actual); const expectedKeys = Object.keys(expected); @@ -170,8 +168,8 @@ trailingTests.forEach((test) => { } if (failed) failures.push(`\n${message}`); - }); -}); + } +} assert.strictEqual(failures.length, 0, failures.join('')); function checkErrors(path) {