Skip to content

Commit c400448

Browse files
Trotttargos
authored andcommitted
test: improve debug output in trace-events test
test-trace-events-fs-sync is swallowing useful information when it fails. This change results in more information being displayed. PR-URL: #21120 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Lance Ball <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent a4ad989 commit c400448

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/parallel/test-trace-events-fs-sync.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const common = require('../common');
33
const assert = require('assert');
44
const cp = require('child_process');
55
const fs = require('fs');
6+
const util = require('util');
67

78
if (!common.isMainThread)
89
common.skip('process.chdir is not available in Workers');
@@ -121,7 +122,8 @@ for (const tr in tests) {
121122
const proc = cp.spawnSync(process.execPath,
122123
[ '--trace-events-enabled',
123124
'--trace-event-categories', 'node.fs.sync',
124-
'-e', tests[tr] ]);
125+
'-e', tests[tr] ],
126+
{ encoding: 'utf8' });
125127
// Some AIX versions don't support futimes or utimes, so skip.
126128
if (common.isAIX && proc.status !== 0 && tr === 'fs.sync.futimes') {
127129
continue;
@@ -131,7 +133,7 @@ for (const tr in tests) {
131133
}
132134

133135
// Make sure the operation is successful.
134-
assert.strictEqual(proc.status, 0, tr + ': ' + proc.stderr);
136+
assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`);
135137

136138
// Confirm that trace log file is created.
137139
assert(common.fileExists(traceFile));

0 commit comments

Comments
 (0)