Skip to content

Commit 36cc8df

Browse files
joyeecheungtargos
authored andcommitted
test: log error in test-fs-realpath-pipe
Show more information when the test fails. PR-URL: #36996 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 36930e4 commit 36cc8df

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/parallel/test-fs-realpath-pipe.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const { spawnSync } = require('child_process');
1212
for (const code of [
1313
`require('fs').realpath('/dev/stdin', (err, resolvedPath) => {
1414
if (err) {
15+
console.error(err);
1516
process.exit(1);
1617
}
1718
if (resolvedPath) {
@@ -22,11 +23,17 @@ for (const code of [
2223
if (require('fs').realpathSync('/dev/stdin')) {
2324
process.exit(2);
2425
}
25-
} catch {
26+
} catch (e) {
27+
console.error(e);
2628
process.exit(1);
2729
}`
2830
]) {
29-
assert.strictEqual(spawnSync(process.execPath, ['-e', code], {
31+
const child = spawnSync(process.execPath, ['-e', code], {
3032
stdio: 'pipe'
31-
}).status, 2);
33+
});
34+
if (child.status !== 2) {
35+
console.log(code);
36+
console.log(child.stderr.toString());
37+
}
38+
assert.strictEqual(child.status, 2);
3239
}

0 commit comments

Comments
 (0)