Skip to content

Commit 93d7fa3

Browse files
committed
test: only inspect on failure
The inspection was done in all cases so far and that's not necessary. Therefore this changed this behavior to only inspect the input on failure cases. PR-URL: #26360 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent b6355ef commit 93d7fa3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/parallel/test-path-join.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ joinTests.forEach((test) => {
131131
} else {
132132
os = 'posix';
133133
}
134-
const message =
135-
`path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${
134+
if (actual !== expected && actualAlt !== expected) {
135+
const delimiter = test[0].map(JSON.stringify).join(',');
136+
const message = `path.${os}.join(${delimiter})\n expect=${
136137
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
137-
if (actual !== expected && actualAlt !== expected)
138138
failures.push(`\n${message}`);
139+
}
139140
});
140141
});
141142
});

test/parallel/test-path-relative.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ relativeTests.forEach((test) => {
5656
test[1].forEach((test) => {
5757
const actual = relative(test[0], test[1]);
5858
const expected = test[2];
59-
const os = relative === path.win32.relative ? 'win32' : 'posix';
60-
const message = `path.${os}.relative(${
61-
test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
62-
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
63-
if (actual !== expected)
59+
if (actual !== expected) {
60+
const os = relative === path.win32.relative ? 'win32' : 'posix';
61+
const message = `path.${os}.relative(${
62+
test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
63+
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
6464
failures.push(`\n${message}`);
65+
}
6566
});
6667
});
6768
assert.strictEqual(failures.length, 0, failures.join(''));

0 commit comments

Comments
 (0)