From d1e98c5ec260488f31a51d48fb40c1e54d9e43ae 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 +- .../lib/static/components/controls/browser-list/index.jsx | 8 ++++---- test/unit/lib/static/components/state/state-error.jsx | 6 +++--- 5 files changed, 10 insertions(+), 10 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); diff --git a/test/unit/lib/static/components/controls/browser-list/index.jsx b/test/unit/lib/static/components/controls/browser-list/index.jsx index c96d917ec..834acfaab 100644 --- a/test/unit/lib/static/components/controls/browser-list/index.jsx +++ b/test/unit/lib/static/components/controls/browser-list/index.jsx @@ -33,8 +33,8 @@ describe('', () => { const component = mount(); assert.equal(component.find('.array__container .array__item').length, 2); - assert.equal(component.find('.array__container .array__item').at(0).text(), 'bro2'); - assert.equal(component.find('.array__container .array__item').at(1).text(), 'bro3'); + assert.equal(component.find('.array__container .array__item')[0].text(), 'bro2'); + assert.equal(component.find('.array__container .array__item')[1].text(), 'bro3'); }); it('should create nested checkboxes for versions', async () => { @@ -51,8 +51,8 @@ describe('', () => { const component = mount(); component.find('.rct-collapse').first().simulate('click'); - assert.equal(component.find('.rct-node-leaf .rct-label__title').at(0).text(), 'v1'); - assert.equal(component.find('.rct-node-leaf .rct-label__title').at(1).text(), 'v2'); + assert.equal(component.find('.rct-node-leaf .rct-label__title')[0].text(), 'v1'); + assert.equal(component.find('.rct-node-leaf .rct-label__title')[1].text(), 'v2'); }); it('should trigger "change" event with selected browsers and versions', () => { diff --git a/test/unit/lib/static/components/state/state-error.jsx b/test/unit/lib/static/components/state/state-error.jsx index 4f03a9a93..40ee0c937 100644 --- a/test/unit/lib/static/components/state/state-error.jsx +++ b/test/unit/lib/static/components/state/state-error.jsx @@ -43,8 +43,8 @@ describe(' component', () => { const component = mkStateErrorComponent({result: {error}}, {config: {errorPatterns: []}}); - assert.equal(component.find('.error__item').at(0).text(), 'message: some-msg'); - assert.equal(component.find('.error__item').at(1).text(), 'stack: some-stack'); + assert.equal(component.find('.error__item')[0].text(), 'message: some-msg'); + assert.equal(component.find('.error__item')[1].text(), 'stack: some-stack'); }); it('should break error fields by line break', () => { @@ -97,7 +97,7 @@ describe(' component', () => { const component = mkStateErrorComponent({result: {error}}, {config: {errorPatterns}}); component.find('.details__summary').last().simulate('click'); - assert.equal(component.find('.details__summary').at(1).text(), 'hint: show more'); + assert.equal(component.find('.details__summary')[1].text(), 'hint: show more'); assert.equal(component.find('.details__content .foo-bar').text(), ['some-hint']); }); });