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 e91d14c

Browse filesBrowse files
himself65danielleadams
authored andcommitted
test: simplify test-path-resolve.js
PR-URL: #38671 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7d3a8cb commit e91d14c
Copy full SHA for e91d14c

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-resolve.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-path-resolve.js
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,24 @@ const resolveTests = [
4646
],
4747
],
4848
];
49-
resolveTests.forEach((test) => {
50-
const resolve = test[0];
51-
test[1].forEach((test) => {
52-
const actual = resolve.apply(null, test[0]);
49+
resolveTests.forEach(([resolve, tests]) => {
50+
tests.forEach(([test, expected]) => {
51+
const actual = resolve.apply(null, test);
5352
let actualAlt;
5453
const os = resolve === path.win32.resolve ? 'win32' : 'posix';
5554
if (resolve === path.win32.resolve && !common.isWindows)
5655
actualAlt = actual.replace(backslashRE, '/');
5756
else if (resolve !== path.win32.resolve && common.isWindows)
5857
actualAlt = actual.replace(slashRE, '\\');
5958

60-
const expected = test[1];
6159
const message =
62-
`path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${
60+
`path.${os}.resolve(${test.map(JSON.stringify).join(',')})\n expect=${
6361
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
6462
if (actual !== expected && actualAlt !== expected)
65-
failures.push(`\n${message}`);
63+
failures.push(message);
6664
});
6765
});
68-
assert.strictEqual(failures.length, 0, failures.join(''));
66+
assert.strictEqual(failures.length, 0, failures.join('\n'));
6967

7068
if (common.isWindows) {
7169
// Test resolving the current Windows drive letter from a spawned process.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.