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: https://github.com/nodejs/node/pull/26360 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
f871c80a6d
commit
6c38fcff1d
@ -131,11 +131,12 @@ joinTests.forEach((test) => {
|
||||
} else {
|
||||
os = 'posix';
|
||||
}
|
||||
const message =
|
||||
`path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${
|
||||
if (actual !== expected && actualAlt !== expected) {
|
||||
const delimiter = test[0].map(JSON.stringify).join(',');
|
||||
const message = `path.${os}.join(${delimiter})\n expect=${
|
||||
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
|
||||
if (actual !== expected && actualAlt !== expected)
|
||||
failures.push(`\n${message}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -56,12 +56,13 @@ relativeTests.forEach((test) => {
|
||||
test[1].forEach((test) => {
|
||||
const actual = relative(test[0], test[1]);
|
||||
const expected = test[2];
|
||||
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
||||
const message = `path.${os}.relative(${
|
||||
test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
|
||||
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
|
||||
if (actual !== expected)
|
||||
if (actual !== expected) {
|
||||
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
||||
const message = `path.${os}.relative(${
|
||||
test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
|
||||
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
|
||||
failures.push(`\n${message}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
assert.strictEqual(failures.length, 0, failures.join(''));
|
||||
|
Loading…
x
Reference in New Issue
Block a user