From 8b3de6199b5866a568dd44c115b63b6f522179ff Mon Sep 17 00:00:00 2001 From: "ashish.alex10@gmail.com" Date: Fri, 5 Jul 2024 11:13:32 +0100 Subject: [PATCH] fix: dry run of assertions failing --- 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).`); }