From d3d01948b2b5d429149d20364dccf6de2b842792 Mon Sep 17 00:00:00 2001 From: Ashish Alex <34306898+ashish10alex@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:43:08 +0100 Subject: [PATCH] fix: dry run of assertions failing (#1778) --- cli/api/commands/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/api/commands/run.ts b/cli/api/commands/run.ts index 3af5ec339..426a816e1 100644 --- a/cli/api/commands/run.ts +++ b/cli/api/commands/run.ts @@ -424,7 +424,7 @@ export class Runner { if (task.type === "assertion") { // We expect that an assertion query returns 1 row, with 1 field that is the row count. // We don't really care what that field/column is called. - const rowCount = rows[0][Object.keys(rows[0])[0]]; + const rowCount = rows[0]?.[Object.keys(rows[0])[0]]; if (rowCount > 0) { throw new Error(`Assertion failed: query returned ${rowCount} row(s).`); }