Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a589de0

Browse filesBrowse files
gibbyfreetargos
authored andcommitted
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 0d040a3 commit a589de0
Copy full SHA for a589de0

File tree

Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-path-parse-format.js
+6-8Lines changed: 6 additions & 8 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.