Browse Source

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.

PR-URL: https://github.com/nodejs/node/pull/11065
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Rich Trott 8 years ago
committed by Italo A. Casas
parent
commit
7b253eb3ed
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 14
      test/parallel/test-trace-event.js

14
test/parallel/test-trace-event.js

@ -21,15 +21,19 @@ proc_no_categories.once('exit', common.mustCall(() => {
proc.once('exit', common.mustCall(() => { proc.once('exit', common.mustCall(() => {
assert(common.fileExists(FILE_NAME)); 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; const traces = JSON.parse(data.toString()).traceEvents;
assert(traces.length > 0); assert(traces.length > 0);
// Values that should be present on all runs to approximate correctness. // 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) => { 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;
})); }));
}); }));
})); }));
})); }));

Loading…
Cancel
Save