diff --git a/test/parallel/test-path-join.js b/test/parallel/test-path-join.js index 945cf0e9b5d772..a9fb5b1e927552 100644 --- a/test/parallel/test-path-join.js +++ b/test/parallel/test-path-join.js @@ -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}`); + } }); }); }); diff --git a/test/parallel/test-path-relative.js b/test/parallel/test-path-relative.js index bd2c3f75a52dd2..26521bc088a8f7 100644 --- a/test/parallel/test-path-relative.js +++ b/test/parallel/test-path-relative.js @@ -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(''));