From 439f1bfbe198025759912727f2ff8da481337388 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 26 Nov 2025 11:31:54 +0400 Subject: [PATCH 1/6] EPMRPP-84449 || Added 'skippedIssue' --- __tests__/report-portal-client.spec.js | 85 ++++++++++++++++++++++++++ index.d.ts | 1 + lib/commons/config.js | 1 + lib/report-portal-client.js | 4 ++ 4 files changed, 91 insertions(+) diff --git a/__tests__/report-portal-client.spec.js b/__tests__/report-portal-client.spec.js index b715aef..b401655 100644 --- a/__tests__/report-portal-client.spec.js +++ b/__tests__/report-portal-client.spec.js @@ -876,6 +876,91 @@ describe('ReportPortal javascript client', () => { }); }); + it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIssue is false', function (done) { + const mockClient = new RPClient({ + apiKey: 'test', + endpoint: 'https://reportportal-stub-url', + launch: 'test launch', + project: 'test project', + skippedIssue: false, + }, { name: 'test', version: '1.0.0' }); + + const spyFinishTestItemPromiseStart = jest.spyOn(mockClient, 'finishTestItemPromiseStart').mockImplementation(() => {}); + + mockClient.map = { + testItemId: { + children: [], + finishSend: false, + promiseFinish: Promise.resolve(), + resolveFinish: () => {}, + }, + }; + + const finishTestItemRQ = { + status: 'skipped', + }; + + mockClient.finishTestItem('testItemId', finishTestItemRQ); + + setTimeout(() => { + expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + status: 'skipped', + issue: { issueType: 'NOT_ISSUE' }, + }) + ); + done(); + }, 50); + }); + + it('should not add NOT_ISSUE when status is SKIPPED and skippedIssue is true', function (done) { + const mockClient = new RPClient({ + apiKey: 'test', + endpoint: 'https://reportportal-stub-url', + launch: 'test launch', + project: 'test project', + skippedIssue: true, + }, { name: 'test', version: '1.0.0' }); + + const spyFinishTestItemPromiseStart = jest.spyOn(mockClient, 'finishTestItemPromiseStart').mockImplementation(() => {}); + + mockClient.map = { + testItemId: { + children: [], + finishSend: false, + promiseFinish: Promise.resolve(), + resolveFinish: () => {}, + }, + }; + + const finishTestItemRQ = { + status: 'skipped', + }; + + mockClient.finishTestItem('testItemId', finishTestItemRQ); + + setTimeout(() => { + expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + status: 'skipped', + }) + ); + expect(spyFinishTestItemPromiseStart).not.toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + issue: expect.anything(), + }) + ); + done(); + }, 100); + + }); + describe('saveLog', () => { it('should return object with tempId and promise', () => { const client = new RPClient({ apiKey: 'any', endpoint: 'https://rp.api', project: 'prj' }); diff --git a/index.d.ts b/index.d.ts index 5a40901..83ad7c8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -155,6 +155,7 @@ declare module '@reportportal/client-javascript' { launchUuidPrintOutput?: string; restClientConfig?: RestClientConfig; token?: string; + skippedIssue?: boolean; /** * OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key. */ diff --git a/lib/commons/config.js b/lib/commons/config.js index 1fdd042..f605d24 100644 --- a/lib/commons/config.js +++ b/lib/commons/config.js @@ -115,6 +115,7 @@ const getClientConfig = (options) => { description: options.description, launchUuidPrint: options.launchUuidPrint, launchUuidPrintOutput, + skippedIssue: options.skippedIssue, }; } catch (error) { // don't throw the error up to not break the entire process diff --git a/lib/report-portal-client.js b/lib/report-portal-client.js index 9869cf4..92c7cc2 100644 --- a/lib/report-portal-client.js +++ b/lib/report-portal-client.js @@ -610,6 +610,10 @@ class RPClient { ...(itemObj.children.length ? {} : { status: RP_STATUSES.PASSED }), ...finishTestItemRQ, }; + + if (finishTestItemData.status === RP_STATUSES.SKIPPED && this.config.skippedIssue === false) { + finishTestItemData.issue = { issueType: 'NOT_ISSUE' }; + } itemObj.finishSend = true; this.logDebug(`Finish all children for test item with tempId ${itemTempId}`); From a852998780e20cbe966d032f52bf555f8250349c Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 26 Nov 2025 11:50:14 +0400 Subject: [PATCH 2/6] EPMRPP-84449 || format fix --- __tests__/report-portal-client.spec.js | 49 +++++++++++++++----------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/__tests__/report-portal-client.spec.js b/__tests__/report-portal-client.spec.js index b401655..c3c09b9 100644 --- a/__tests__/report-portal-client.spec.js +++ b/__tests__/report-portal-client.spec.js @@ -877,15 +877,20 @@ describe('ReportPortal javascript client', () => { }); it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIssue is false', function (done) { - const mockClient = new RPClient({ - apiKey: 'test', - endpoint: 'https://reportportal-stub-url', - launch: 'test launch', - project: 'test project', - skippedIssue: false, - }, { name: 'test', version: '1.0.0' }); + const mockClient = new RPClient( + { + apiKey: 'test', + endpoint: 'https://reportportal-stub-url', + launch: 'test launch', + project: 'test project', + skippedIssue: false, + }, + { name: 'test', version: '1.0.0' }, + ); - const spyFinishTestItemPromiseStart = jest.spyOn(mockClient, 'finishTestItemPromiseStart').mockImplementation(() => {}); + const spyFinishTestItemPromiseStart = jest + .spyOn(mockClient, 'finishTestItemPromiseStart') + .mockImplementation(() => {}); mockClient.map = { testItemId: { @@ -909,22 +914,27 @@ describe('ReportPortal javascript client', () => { expect.objectContaining({ status: 'skipped', issue: { issueType: 'NOT_ISSUE' }, - }) + }), ); done(); }, 50); }); it('should not add NOT_ISSUE when status is SKIPPED and skippedIssue is true', function (done) { - const mockClient = new RPClient({ - apiKey: 'test', - endpoint: 'https://reportportal-stub-url', - launch: 'test launch', - project: 'test project', - skippedIssue: true, - }, { name: 'test', version: '1.0.0' }); + const mockClient = new RPClient( + { + apiKey: 'test', + endpoint: 'https://reportportal-stub-url', + launch: 'test launch', + project: 'test project', + skippedIssue: true, + }, + { name: 'test', version: '1.0.0' }, + ); - const spyFinishTestItemPromiseStart = jest.spyOn(mockClient, 'finishTestItemPromiseStart').mockImplementation(() => {}); + const spyFinishTestItemPromiseStart = jest + .spyOn(mockClient, 'finishTestItemPromiseStart') + .mockImplementation(() => {}); mockClient.map = { testItemId: { @@ -947,18 +957,17 @@ describe('ReportPortal javascript client', () => { 'testItemId', expect.objectContaining({ status: 'skipped', - }) + }), ); expect(spyFinishTestItemPromiseStart).not.toHaveBeenCalledWith( expect.any(Object), 'testItemId', expect.objectContaining({ issue: expect.anything(), - }) + }), ); done(); }, 100); - }); describe('saveLog', () => { From 85891ab34f670088d0bc117d554e80d31ce37d0f Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 26 Nov 2025 12:01:16 +0400 Subject: [PATCH 3/6] EPMRPP-84449 || Exclude tests from lint --- .eslintrc | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index b676b19..67846ac 100644 --- a/.eslintrc +++ b/.eslintrc @@ -19,6 +19,7 @@ "es6": true, "jest": true }, + "ignorePatterns": ["__tests__/**/*"], "rules": { "valid-jsdoc": ["error", { "requireReturn": false }], "consistent-return": 0, diff --git a/package.json b/package.json index 66feaaa..a83c719 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "npm run clean && tsc", "clean": "rimraf ./build", - "lint": "eslint ./statistics/**/* ./lib/**/* ./__tests__/**/*", + "lint": "eslint ./statistics/**/* ./lib/**/*", "format": "npm run lint -- --fix", "test": "jest", "test:coverage": "jest --coverage" From 8fd0312f7f5cfc00135b877571426c43aeb35bd1 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 10 Dec 2025 01:53:08 +0400 Subject: [PATCH 4/6] EPMRPP-84449 || crf --- __tests__/report-portal-client.spec.js | 48 +++++++++++++++++++++++--- index.d.ts | 2 +- lib/commons/config.js | 2 +- lib/report-portal-client.js | 15 ++++++-- 4 files changed, 59 insertions(+), 8 deletions(-) diff --git a/__tests__/report-portal-client.spec.js b/__tests__/report-portal-client.spec.js index c3c09b9..54013f6 100644 --- a/__tests__/report-portal-client.spec.js +++ b/__tests__/report-portal-client.spec.js @@ -876,14 +876,14 @@ describe('ReportPortal javascript client', () => { }); }); - it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIssue is false', function (done) { + it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is true', function (done) { const mockClient = new RPClient( { apiKey: 'test', endpoint: 'https://reportportal-stub-url', launch: 'test launch', project: 'test project', - skippedIssue: false, + skippedIsNotIssue: true, }, { name: 'test', version: '1.0.0' }, ); @@ -920,14 +920,54 @@ describe('ReportPortal javascript client', () => { }, 50); }); - it('should not add NOT_ISSUE when status is SKIPPED and skippedIssue is true', function (done) { + it('should support legacy skippedIssue config option', function (done) { + const mockClient = new RPClient( + { + apiKey: 'test', + endpoint: 'https://reportportal-stub-url', + launch: 'test launch', + project: 'test project', + skippedIssue: false, + }, + { name: 'test', version: '1.0.0' }, + ); + + const spyFinishTestItemPromiseStart = jest + .spyOn(mockClient, 'finishTestItemPromiseStart') + .mockImplementation(() => {}); + + mockClient.map = { + testItemId: { + children: [], + finishSend: false, + promiseFinish: Promise.resolve(), + resolveFinish: () => {}, + }, + }; + + mockClient.finishTestItem('testItemId', { status: 'skipped' }); + + setTimeout(() => { + expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + status: 'skipped', + issue: { issueType: 'NOT_ISSUE' }, + }), + ); + done(); + }, 50); + }); + + it('should not add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is false', function (done) { const mockClient = new RPClient( { apiKey: 'test', endpoint: 'https://reportportal-stub-url', launch: 'test launch', project: 'test project', - skippedIssue: true, + skippedIsNotIssue: false, }, { name: 'test', version: '1.0.0' }, ); diff --git a/index.d.ts b/index.d.ts index 83ad7c8..8c7e993 100644 --- a/index.d.ts +++ b/index.d.ts @@ -155,7 +155,7 @@ declare module '@reportportal/client-javascript' { launchUuidPrintOutput?: string; restClientConfig?: RestClientConfig; token?: string; - skippedIssue?: boolean; + skippedIsNotIssue?: boolean; /** * OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key. */ diff --git a/lib/commons/config.js b/lib/commons/config.js index f605d24..0700b92 100644 --- a/lib/commons/config.js +++ b/lib/commons/config.js @@ -115,7 +115,7 @@ const getClientConfig = (options) => { description: options.description, launchUuidPrint: options.launchUuidPrint, launchUuidPrintOutput, - skippedIssue: options.skippedIssue, + skippedIsNotIssue: !!options.skippedIsNotIssue, }; } catch (error) { // don't throw the error up to not break the entire process diff --git a/lib/report-portal-client.js b/lib/report-portal-client.js index 92c7cc2..fcb4b57 100644 --- a/lib/report-portal-client.js +++ b/lib/report-portal-client.js @@ -201,6 +201,14 @@ class RPClient { this.launchUuid = launchDataRQ.id; } else { const systemAttr = helpers.getSystemAttribute(); + if (this.config.skippedIsNotIssue === true) { + const skippedIsNotIssueAttribute = { + key: 'skippedIssue', + value: 'false', + system: true, + }; + systemAttr.push(skippedIsNotIssueAttribute); + } const attributes = Array.isArray(launchDataRQ.attributes) ? launchDataRQ.attributes.concat(systemAttr) : systemAttr; @@ -610,8 +618,11 @@ class RPClient { ...(itemObj.children.length ? {} : { status: RP_STATUSES.PASSED }), ...finishTestItemRQ, }; - - if (finishTestItemData.status === RP_STATUSES.SKIPPED && this.config.skippedIssue === false) { + + if ( + finishTestItemData.status === RP_STATUSES.SKIPPED && + this.config.skippedIsNotIssue === true + ) { finishTestItemData.issue = { issueType: 'NOT_ISSUE' }; } From 436dddd3841d61d66c53fdacc1095486f8e98b74 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 10 Dec 2025 02:00:01 +0400 Subject: [PATCH 5/6] EPMRPP-84449 || removed redundant test --- __tests__/report-portal-client.spec.js | 40 -------------------------- 1 file changed, 40 deletions(-) diff --git a/__tests__/report-portal-client.spec.js b/__tests__/report-portal-client.spec.js index 54013f6..44e266d 100644 --- a/__tests__/report-portal-client.spec.js +++ b/__tests__/report-portal-client.spec.js @@ -920,46 +920,6 @@ describe('ReportPortal javascript client', () => { }, 50); }); - it('should support legacy skippedIssue config option', function (done) { - const mockClient = new RPClient( - { - apiKey: 'test', - endpoint: 'https://reportportal-stub-url', - launch: 'test launch', - project: 'test project', - skippedIssue: false, - }, - { name: 'test', version: '1.0.0' }, - ); - - const spyFinishTestItemPromiseStart = jest - .spyOn(mockClient, 'finishTestItemPromiseStart') - .mockImplementation(() => {}); - - mockClient.map = { - testItemId: { - children: [], - finishSend: false, - promiseFinish: Promise.resolve(), - resolveFinish: () => {}, - }, - }; - - mockClient.finishTestItem('testItemId', { status: 'skipped' }); - - setTimeout(() => { - expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( - expect.any(Object), - 'testItemId', - expect.objectContaining({ - status: 'skipped', - issue: { issueType: 'NOT_ISSUE' }, - }), - ); - done(); - }, 50); - }); - it('should not add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is false', function (done) { const mockClient = new RPClient( { From e77dd52ce2041f84806d42cf0abb93290b0dd57e Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Wed, 10 Dec 2025 02:05:58 +0400 Subject: [PATCH 6/6] EPMRPP-84449 || coderabbitai comment fix --- __tests__/report-portal-client.spec.js | 56 +++++++++++++++----------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/__tests__/report-portal-client.spec.js b/__tests__/report-portal-client.spec.js index 44e266d..e0ced6e 100644 --- a/__tests__/report-portal-client.spec.js +++ b/__tests__/report-portal-client.spec.js @@ -908,15 +908,19 @@ describe('ReportPortal javascript client', () => { mockClient.finishTestItem('testItemId', finishTestItemRQ); setTimeout(() => { - expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( - expect.any(Object), - 'testItemId', - expect.objectContaining({ - status: 'skipped', - issue: { issueType: 'NOT_ISSUE' }, - }), - ); - done(); + try { + expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + status: 'skipped', + issue: { issueType: 'NOT_ISSUE' }, + }), + ); + done(); + } catch (error) { + done(error); + } }, 50); }); @@ -952,21 +956,25 @@ describe('ReportPortal javascript client', () => { mockClient.finishTestItem('testItemId', finishTestItemRQ); setTimeout(() => { - expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( - expect.any(Object), - 'testItemId', - expect.objectContaining({ - status: 'skipped', - }), - ); - expect(spyFinishTestItemPromiseStart).not.toHaveBeenCalledWith( - expect.any(Object), - 'testItemId', - expect.objectContaining({ - issue: expect.anything(), - }), - ); - done(); + try { + expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + status: 'skipped', + }), + ); + expect(spyFinishTestItemPromiseStart).not.toHaveBeenCalledWith( + expect.any(Object), + 'testItemId', + expect.objectContaining({ + issue: expect.anything(), + }), + ); + done(); + } catch (error) { + done(error); + } }, 100); });