◐ Shell
clean mode source ↗

test: improve debug output in trace-events test · nodejs/node@c400448

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));