Skip to content

Commit 7b253eb

Browse files
Trottitaloacasas
authored andcommitted
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: #11065 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 96f55f9 commit 7b253eb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/parallel/test-trace-event.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ proc_no_categories.once('exit', common.mustCall(() => {
2121

2222
proc.once('exit', common.mustCall(() => {
2323
assert(common.fileExists(FILE_NAME));
24-
fs.readFile(FILE_NAME, (err, data) => {
24+
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
2525
const traces = JSON.parse(data.toString()).traceEvents;
2626
assert(traces.length > 0);
2727
// Values that should be present on all runs to approximate correctness.
28-
assert(traces.some((trace) => { return trace.pid === proc.pid; }));
29-
assert(traces.some((trace) => { return trace.cat === 'v8'; }));
3028
assert(traces.some((trace) => {
31-
return trace.name === 'V8.ScriptCompiler';
29+
if (trace.pid !== proc.pid)
30+
return false;
31+
if (trace.cat !== 'v8')
32+
return false;
33+
if (trace.name !== 'V8.ScriptCompiler')
34+
return false;
35+
return true;
3236
}));
33-
});
37+
}));
3438
}));
3539
}));

0 commit comments

Comments
 (0)