Skip to content

Commit e91d14c

Browse files
himself65danielleadams
authored andcommitted
test: simplify test-path-resolve.js
PR-URL: #38671 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 7d3a8cb commit e91d14c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

test/parallel/test-path-resolve.js

+6-8
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)