From 4875b0f9e4bbef8c4389484aea8899956b4aac86 Mon Sep 17 00:00:00 2001 From: Roman Kuznetsov Date: Wed, 27 Mar 2024 23:39:46 +0300 Subject: [PATCH] fix: node@14 compatibility --- lib/test-adapter/reporter.ts | 2 +- lib/test-adapter/sqlite.ts | 2 +- lib/test-attempt-manager.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/test-adapter/reporter.ts b/lib/test-adapter/reporter.ts index bcd0ac593..d0a68380c 100644 --- a/lib/test-adapter/reporter.ts +++ b/lib/test-adapter/reporter.ts @@ -89,7 +89,7 @@ export class ReporterTestAdapter implements ReporterTestResult { } get state(): {name: string;} { - return {name: this.testPath.at(-1) as string}; + return {name: this.testPath[this.testPath.length - 1]}; } get status(): TestStatus { diff --git a/lib/test-adapter/sqlite.ts b/lib/test-adapter/sqlite.ts index 658ba3ee7..4e12d0757 100644 --- a/lib/test-adapter/sqlite.ts +++ b/lib/test-adapter/sqlite.ts @@ -135,7 +135,7 @@ export class SqliteTestAdapter implements ReporterTestResult { } get state(): { name: string; } { - return {name: this.testPath.at(-1) as string}; + return {name: this.testPath[this.testPath.length - 1]}; } get status(): TestStatus { diff --git a/lib/test-attempt-manager.ts b/lib/test-attempt-manager.ts index 2b65263e5..009ce4185 100644 --- a/lib/test-attempt-manager.ts +++ b/lib/test-attempt-manager.ts @@ -36,7 +36,7 @@ export class TestAttemptManager { const [hash, data] = this._getData(testResult); const isManualOverride = index !== null; - const isLastStatusTemporary = [IDLE, RUNNING].includes(data.statuses.at(-1) as TestStatus); + const isLastStatusTemporary = [IDLE, RUNNING].includes(data.statuses[data.statuses.length - 1]); const shouldReplace = Number(isManualOverride || isLastStatusTemporary); data.statuses.splice(index ?? data.statuses.length - shouldReplace, shouldReplace, status);