Skip to content

Commit

Permalink
test: only inspect on failure
Browse files Browse the repository at this point in the history
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 <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
BridgeAR committed Mar 4, 2019
1 parent b6355ef commit 93d7fa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions test/parallel/test-path-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
});
});
});
Expand Down
11 changes: 6 additions & 5 deletions test/parallel/test-path-relative.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(''));

0 comments on commit 93d7fa3

Please sign in to comment.