From d99f1755d3cfacca889cbec1af8570461511d592 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 18 Jan 2021 23:26:13 +0800 Subject: [PATCH] test: log error in test-fs-realpath-pipe Show more information when the test fails. PR-URL: https://github.com/nodejs/node/pull/36996 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-fs-realpath-pipe.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js index 7104e93ff123ed..a2e88cce422e07 100644 --- a/test/parallel/test-fs-realpath-pipe.js +++ b/test/parallel/test-fs-realpath-pipe.js @@ -12,6 +12,7 @@ const { spawnSync } = require('child_process'); for (const code of [ `require('fs').realpath('/dev/stdin', (err, resolvedPath) => { if (err) { + console.error(err); process.exit(1); } if (resolvedPath) { @@ -22,11 +23,17 @@ for (const code of [ if (require('fs').realpathSync('/dev/stdin')) { process.exit(2); } - } catch { + } catch (e) { + console.error(e); process.exit(1); }` ]) { - assert.strictEqual(spawnSync(process.execPath, ['-e', code], { + const child = spawnSync(process.execPath, ['-e', code], { stdio: 'pipe' - }).status, 2); + }); + if (child.status !== 2) { + console.log(code); + console.log(child.stderr.toString()); + } + assert.strictEqual(child.status, 2); }