Skip to content

Commit 0513e07

Browse files
gibbyfreemarco-ippolito
authored andcommittedJun 17, 2024
test: use for-of instead of forEach
PR-URL: #49790 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruy Adorno <ruy@vlt.sh> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 0fb7c18 commit 0513e07

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed
 

‎test/parallel/test-path-parse-format.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,11 @@ const trailingTests = [
148148
],
149149
];
150150
const failures = [];
151-
trailingTests.forEach((test) => {
152-
const parse = test[0];
151+
for (const [parse, testList] of trailingTests) {
153152
const os = parse === path.win32.parse ? 'win32' : 'posix';
154-
test[1].forEach((test) => {
155-
const actual = parse(test[0]);
156-
const expected = test[1];
157-
const message = `path.${os}.parse(${JSON.stringify(test[0])})\n expect=${
153+
for (const [input, expected] of testList) {
154+
const actual = parse(input);
155+
const message = `path.${os}.parse(${JSON.stringify(input)})\n expect=${
158156
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
159157
const actualKeys = Object.keys(actual);
160158
const expectedKeys = Object.keys(expected);
@@ -170,8 +168,8 @@ trailingTests.forEach((test) => {
170168
}
171169
if (failed)
172170
failures.push(`\n${message}`);
173-
});
174-
});
171+
}
172+
}
175173
assert.strictEqual(failures.length, 0, failures.join(''));
176174

177175
function checkErrors(path) {

0 commit comments

Comments
 (0)
Please sign in to comment.