From 26c3f6612d08a88ea22cd5606731a2e1489112b7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 4 Jun 2018 11:34:09 +0200 Subject: [PATCH] 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. --- test/parallel/test-trace-events-fs-sync.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-trace-events-fs-sync.js b/test/parallel/test-trace-events-fs-sync.js index 60ab5efa3a1d3d..94f7a94b935254 100644 --- a/test/parallel/test-trace-events-fs-sync.js +++ b/test/parallel/test-trace-events-fs-sync.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); +const util = require('util'); const tests = new Array(); const traceFile = 'node_trace.1.log'; @@ -118,7 +119,8 @@ for (const tr in tests) { const proc = cp.spawnSync(process.execPath, [ '--trace-events-enabled', '--trace-event-categories', 'node.fs.sync', - '-e', tests[tr] ]); + '-e', tests[tr] ], + { encoding: 'utf8' }); // Some AIX versions don't support futimes or utimes, so skip. if (common.isAIX && proc.status !== 0 && tr === 'fs.sync.futimes') { continue; @@ -128,7 +130,7 @@ for (const tr in tests) { } // Make sure the operation is successful. - assert.strictEqual(proc.status, 0, tr + ': ' + proc.stderr); + assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`); // Confirm that trace log file is created. assert(common.fileExists(traceFile));