Skip to content

Commit

Permalink
test: relax check in verify-graph
Browse files Browse the repository at this point in the history
Relax the check regarding presence of async resources in graph to
allow extra events. Before this change events not mentioned in
reference graph were allowed but that one specified must match
exactly in count. Now it's allowed to have more events of this
type.

Refs: nodejs#27477
Fixes: nodejs#27617

PR-URL: nodejs#27742
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
Flarna authored and addaleax committed May 19, 2019
1 parent bd895af commit ee59763
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/async-hooks/verify-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ module.exports = function verifyGraph(hooks, graph) {
}
assert.strictEqual(errors.length, 0);

// Verify that all expected types are present
// Verify that all expected types are present (but more/others are allowed)
const expTypes = Object.create(null);
for (let i = 0; i < graph.length; i++) {
if (expTypes[graph[i].type] == null) expTypes[graph[i].type] = 0;
expTypes[graph[i].type]++;
}

for (const type in expTypes) {
assert.strictEqual(typeSeen[type], expTypes[type],
`Type '${type}': expecting: ${expTypes[type]} ` +
`found ${typeSeen[type]}`);
assert.ok(typeSeen[type] >= expTypes[type],
`Type '${type}': expecting: ${expTypes[type]} ` +
`found: ${typeSeen[type]}`);
}
};

Expand Down

0 comments on commit ee59763

Please sign in to comment.