Skip to content

Commit

Permalink
test: log error in test-fs-realpath-pipe
Browse files Browse the repository at this point in the history
Show more information when the test fails.

PR-URL: #36996
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
joyeecheung authored and targos committed Feb 2, 2021
1 parent 36930e4 commit 36cc8df
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/parallel/test-fs-realpath-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}

0 comments on commit 36cc8df

Please sign in to comment.