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
  • Loading branch information
Flarna committed May 16, 2019
1 parent f206193 commit 0b66d33
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 0b66d33

Please sign in to comment.