From 14009ba6db08292fb5ffe726c64bea8664008a99 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 28 Jan 2017 21:47:14 -0800 Subject: [PATCH] test: increase strictness for test-trace-event Change test-trace-event such that it checks that all expected values are within the same trace object rather than scattered across multiple trace objects. --- test/parallel/test-trace-event.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-trace-event.js b/test/parallel/test-trace-event.js index 18734705834407..fde718d7bc06fb 100644 --- a/test/parallel/test-trace-event.js +++ b/test/parallel/test-trace-event.js @@ -21,15 +21,19 @@ proc_no_categories.once('exit', common.mustCall(() => { proc.once('exit', common.mustCall(() => { assert(common.fileExists(FILE_NAME)); - fs.readFile(FILE_NAME, (err, data) => { + fs.readFile(FILE_NAME, common.mustCall((err, data) => { const traces = JSON.parse(data.toString()).traceEvents; assert(traces.length > 0); // Values that should be present on all runs to approximate correctness. - assert(traces.some((trace) => { return trace.pid === proc.pid; })); - assert(traces.some((trace) => { return trace.cat === 'v8'; })); assert(traces.some((trace) => { - return trace.name === 'V8.ScriptCompiler'; + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'v8') + return false; + if (trace.name !== 'V8.ScriptCompiler') + return false; + return true; })); - }); + })); })); }));