Skip to content

Commit 5350277

Browse files
committed
tests: fix perf regression deep-tree traversal typing
1 parent 9b0893c commit 5350277

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/perf-regression.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ test("perf regression: runtime executes deeply nested tree under threshold", asy
108108

109109
assert.equal(result.root.type, "element");
110110
let traversedDepth = 0;
111-
let cursor = result.root;
111+
let cursor: RuntimePlan["root"] = result.root;
112112
while (cursor.type === "element" && cursor.children?.length) {
113113
traversedDepth += 1;
114-
cursor = cursor.children[0];
114+
const nextNode: RuntimePlan["root"] | undefined = cursor.children[0];
115+
if (!nextNode) {
116+
break;
117+
}
118+
cursor = nextNode;
115119
}
116120
assert.ok(traversedDepth >= depth, `deep tree depth=${traversedDepth}`);
117121
assert.ok(

0 commit comments

Comments
 (0)