From 0c8e9ee62e7ce26c4b21a828262fd65e510dbf94 Mon Sep 17 00:00:00 2001 From: Alexander Sattelmaier Date: Sun, 17 Feb 2019 21:10:01 +0100 Subject: [PATCH] test: fix for activities in tick objects prune function PR-URL: https://github.com/nodejs/node/pull/26163 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/async-hooks/verify-graph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } }