From 2009f18064f6ae7b18c3fda7991c1cdca4fb95e6 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 2 Feb 2019 15:56:43 +0100 Subject: [PATCH] test,tracing: use close event to wait for stdio Use `'close'` rather than `'exit'` to make sure that all stdio has been captured by the time that the event handler is run. PR-URL: https://github.com/nodejs/node/pull/25894 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Anto Aravinth Reviewed-By: Colin Ihrig --- test/parallel/test-trace-events-category-used.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-trace-events-category-used.js b/test/parallel/test-trace-events-category-used.js index bedc27bac4d45b..f4b839dddced35 100644 --- a/test/parallel/test-trace-events-category-used.js +++ b/test/parallel/test-trace-events-category-used.js @@ -28,7 +28,7 @@ let procEnabledOutput = ''; procEnabled.stdout.on('data', (data) => procEnabledOutput += data); procEnabled.stderr.pipe(process.stderr); -procEnabled.once('exit', common.mustCall(() => { +procEnabled.once('close', common.mustCall(() => { assert.strictEqual(procEnabledOutput, 'true\n'); })); @@ -46,6 +46,6 @@ let procDisabledOutput = ''; procDisabled.stdout.on('data', (data) => procDisabledOutput += data); procDisabled.stderr.pipe(process.stderr); -procDisabled.once('exit', common.mustCall(() => { +procDisabled.once('close', common.mustCall(() => { assert.strictEqual(procDisabledOutput, 'false\n'); }));