diff --git a/test/async-hooks/verify-graph.js b/test/async-hooks/verify-graph.js index c402dc3ba894ce..d1e09f92bc4adf 100644 --- a/test/async-hooks/verify-graph.js +++ b/test/async-hooks/verify-graph.js @@ -23,12 +23,15 @@ function pruneTickObjects(activities) { data: null }; + if (!Array.isArray(activities)) + return activities; + while (tickObject.found) { for (let i = 0; i < activities.length; i++) { if (activities[i].type === 'TickObject') { tickObject.index = i; break; - } else if (i + 1 === activities.length) { + } else if (i + 1 >= activities.length) { tickObject.found = false; } }