From 4a063d8a4a19735f3b1e7fb84edd861b39c5da4c Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Tue, 21 Oct 2025 15:16:02 +0000 Subject: [PATCH 1/6] 5.6.1 -> 5.6.2-SNAPSHOT --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b7c7542..5c16d40 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.6.1 +5.6.2-SNAPSHOT From bf51f0b730f560574a927a1b69ab4282377c6e38 Mon Sep 17 00:00:00 2001 From: Ilya Date: Mon, 3 Nov 2025 13:01:22 +0100 Subject: [PATCH 2/6] Update publish.yml --- .github/workflows/publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8ea9786..16335f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,10 @@ on: repository_dispatch: types: [version-released] +permissions: + id-token: write # Required for OIDC + contents: read + jobs: build: runs-on: ubuntu-latest From eb93994f59e69224fd7a4446301d8afcdaaa5ca1 Mon Sep 17 00:00:00 2001 From: Ilya_Hancharyk Date: Mon, 3 Nov 2025 15:53:57 +0100 Subject: [PATCH 3/6] EPMRPP-109260 || Update workflows. Add NPM OIDC support --- .github/workflows/CI-pipeline.yml | 19 +++++++++++++------ .github/workflows/publish.yml | 29 +++++++++++++---------------- .github/workflows/release.yml | 10 +++++----- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/workflows/CI-pipeline.yml b/.github/workflows/CI-pipeline.yml index 2a3bbf0..3dff7d0 100644 --- a/.github/workflows/CI-pipeline.yml +++ b/.github/workflows/CI-pipeline.yml @@ -1,4 +1,4 @@ -# Copyright 2024 EPAM Systems +# Copyright 2025 EPAM Systems # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -22,6 +22,9 @@ on: - README.md - CHANGELOG.md pull_request: + branches: + - develop + - master paths-ignore: - README.md - CHANGELOG.md @@ -31,14 +34,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v6 with: - node-version: 20 - - name: Install of node dependencies + node-version: 24 + + - name: Install dependencies run: npm install + - name: Run lint run: npm run lint + - name: Run tests and check coverage run: npm run test:coverage diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 16335f0..f4ee064 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -# Copyright 2024 EPAM Systems +# Copyright 2025 EPAM Systems # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -18,20 +18,20 @@ on: types: [version-released] permissions: - id-token: write # Required for OIDC - contents: read + id-token: write # Required for NPM OIDC + contents: write jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 - - name: Install of node dependencies + node-version: 24 + - name: Install dependencies run: npm install - name: Run lint run: npm run lint @@ -43,25 +43,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 registry-url: 'https://registry.npmjs.org' - - name: Install of node dependencies + - name: Install dependencies run: npm install - name: Publish to NPM run: | - npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN npm config list npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 registry-url: 'https://npm.pkg.github.com' scope: '@reportportal' - name: Publish to GPR diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31a730e..e10fb4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# Copyright 2024 EPAM Systems +# Copyright 2025 EPAM Systems # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -33,7 +33,7 @@ jobs: releaseVersion: ${{ steps.exposeVersion.outputs.releaseVersion }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Read version id: readVersion run: | @@ -78,9 +78,9 @@ jobs: versionInfo: ${{ steps.readChangelogEntry.outputs.log_entry }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup NodeJS - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: '12' - name: Configure git @@ -139,7 +139,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Create Release id: createRelease uses: actions/create-release@v1 From 6d8b3ba0f6314b6439105f8c82729a6a72392691 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian <164881199+maria-hambardzumian@users.noreply.github.com> Date: Thu, 20 Nov 2025 15:40:10 +0400 Subject: [PATCH 4/6] Merge pull request #186 from reportportal/feature/EPMRPP-109178-Add-custom-log-levels-support EPMRPP-109178 || Add custom log levels support --- CHANGELOG.md | 2 + README.md | 5 + modules/constants.js | 4 +- modules/cucumber-reportportal-formatter.js | 16 +- modules/worlds/loggerWorld.js | 72 ++++-- package-lock.json | 2 +- tests/cucumber-reportportal-formatter.spec.js | 10 +- tests/loggerWorld.spec.js | 214 ++++++++++++++++++ 8 files changed, 289 insertions(+), 36 deletions(-) create mode 100644 tests/loggerWorld.spec.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eae98a..29f591c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### Added +- Support for custom log methods with flexible log levels beyond the predefined ones (INFO, ERROR, DEBUG, TRACE, FATAL, WARN). Check the [Logs](README.md#Logs) section in the README for detailed usage examples. ## [5.6.1] - 2025-10-21 ### Added diff --git a/README.md b/README.md index f201106..1c60af5 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,11 @@ Then(/^I should see my new task in the list$/, function() { }); ``` +Custom log methods with flexible log levels: +- `log(message, level)` - Log to items with any predefined or custom log level +- `launchLog(message, level)` - Log to launch with any predefined or custom log level +- `scenarioLog(message, level)` - Log to scenario with any predefined or custom log level + ### Attributes Attributes for features and scenarios are parsed from @tags as `@key:value` pair. diff --git a/modules/constants.js b/modules/constants.js index f040804..1475a89 100644 --- a/modules/constants.js +++ b/modules/constants.js @@ -31,7 +31,7 @@ const STATUSES = { AMBIGUOUS: 'ambiguous', }; -const LOG_LEVELS = { +const PREDEFINED_LOG_LEVELS = { INFO: 'INFO', ERROR: 'ERROR', DEBUG: 'DEBUG', @@ -100,7 +100,7 @@ const TEST_STEP_FINISHED_RP_MESSAGES = { module.exports = { RP_ENTITIES, STATUSES, - LOG_LEVELS, + PREDEFINED_LOG_LEVELS, CUCUMBER_EVENTS, RP_EVENTS, CUCUMBER_MESSAGES, diff --git a/modules/cucumber-reportportal-formatter.js b/modules/cucumber-reportportal-formatter.js index 2375f70..9b340b3 100644 --- a/modules/cucumber-reportportal-formatter.js +++ b/modules/cucumber-reportportal-formatter.js @@ -23,7 +23,7 @@ const pjson = require('../package.json'); const { RP_EVENTS, RP_ENTITIES, - LOG_LEVELS, + PREDEFINED_LOG_LEVELS, STATUSES, CUCUMBER_MESSAGES, TEST_STEP_FINISHED_RP_MESSAGES, @@ -412,7 +412,7 @@ const createRPFormatterClass = (config) => tempId = this.storage.getScenarioTempId(testCaseId); } } else { - request.level = LOG_LEVELS.DEBUG; + request.level = PREDEFINED_LOG_LEVELS.DEBUG; request.message = data.body; } this.reportportal.sendLog(tempId, request); @@ -422,7 +422,7 @@ const createRPFormatterClass = (config) => const fileName = 'file'; // TODO: generate human valuable file name here if possible const request = { time: clientHelpers.now(), - level: LOG_LEVELS.INFO, + level: PREDEFINED_LOG_LEVELS.INFO, message: fileName, file: { name: fileName, @@ -471,7 +471,7 @@ const createRPFormatterClass = (config) => case STATUSES.PENDING: { this.reportportal.sendLog(tempStepId, { time: clientHelpers.now(), - level: LOG_LEVELS.WARN, + level: PREDEFINED_LOG_LEVELS.WARN, message: TEST_STEP_FINISHED_RP_MESSAGES.PENDING, }); status = STATUSES.FAILED; @@ -480,7 +480,7 @@ const createRPFormatterClass = (config) => case STATUSES.UNDEFINED: { this.reportportal.sendLog(tempStepId, { time: clientHelpers.now(), - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: TEST_STEP_FINISHED_RP_MESSAGES.UNDEFINED, }); status = STATUSES.FAILED; @@ -489,7 +489,7 @@ const createRPFormatterClass = (config) => case STATUSES.AMBIGUOUS: { this.reportportal.sendLog(tempStepId, { time: clientHelpers.now(), - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: TEST_STEP_FINISHED_RP_MESSAGES.AMBIGUOUS, }); status = STATUSES.FAILED; @@ -503,7 +503,7 @@ const createRPFormatterClass = (config) => status = STATUSES.FAILED; this.reportportal.sendLog(tempStepId, { time: clientHelpers.now(), - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: stripAnsi(testStepResult.message), }); @@ -518,7 +518,7 @@ const createRPFormatterClass = (config) => const request = { time: clientHelpers.now(), - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, file: { name: screenshotName }, message: screenshotName, }; diff --git a/modules/worlds/loggerWorld.js b/modules/worlds/loggerWorld.js index 409a36a..101c9c6 100644 --- a/modules/worlds/loggerWorld.js +++ b/modules/worlds/loggerWorld.js @@ -1,5 +1,5 @@ /* - * Copyright 2020 EPAM Systems + * Copyright 2025 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -const { LOG_LEVELS, RP_ENTITIES } = require('../constants'); +const { PREDEFINED_LOG_LEVELS, RP_ENTITIES } = require('../constants'); class ReportPortalCucumberLoggerWorld { constructor({ attach, parameters }) { @@ -22,10 +22,20 @@ class ReportPortalCucumberLoggerWorld { this.parameters = parameters; } + log(message, level = PREDEFINED_LOG_LEVELS.INFO) { + this.attach( + JSON.stringify({ + level, + message, + }), + 'text/plain', + ); + } + info(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.INFO, + level: PREDEFINED_LOG_LEVELS.INFO, message: logMessage, }), 'text/plain', @@ -35,7 +45,7 @@ class ReportPortalCucumberLoggerWorld { debug(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.DEBUG, + level: PREDEFINED_LOG_LEVELS.DEBUG, message: logMessage, }), 'text/plain', @@ -45,7 +55,7 @@ class ReportPortalCucumberLoggerWorld { error(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: logMessage, }), 'text/plain', @@ -55,7 +65,7 @@ class ReportPortalCucumberLoggerWorld { warn(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.WARN, + level: PREDEFINED_LOG_LEVELS.WARN, message: logMessage, }), 'text/plain', @@ -65,7 +75,7 @@ class ReportPortalCucumberLoggerWorld { trace(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.TRACE, + level: PREDEFINED_LOG_LEVELS.TRACE, message: logMessage, }), 'text/plain', @@ -75,17 +85,28 @@ class ReportPortalCucumberLoggerWorld { fatal(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.FATAL, + level: PREDEFINED_LOG_LEVELS.FATAL, message: logMessage, }), 'text/plain', ); } + launchLog(message, level) { + this.attach( + JSON.stringify({ + level, + message, + entity: RP_ENTITIES.LAUNCH, + }), + 'text/plain', + ); + } + launchInfo(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.INFO, + level: PREDEFINED_LOG_LEVELS.INFO, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -96,7 +117,7 @@ class ReportPortalCucumberLoggerWorld { launchDebug(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.DEBUG, + level: PREDEFINED_LOG_LEVELS.DEBUG, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -107,7 +128,7 @@ class ReportPortalCucumberLoggerWorld { launchError(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -118,7 +139,7 @@ class ReportPortalCucumberLoggerWorld { launchWarn(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.WARN, + level: PREDEFINED_LOG_LEVELS.WARN, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -129,7 +150,7 @@ class ReportPortalCucumberLoggerWorld { launchTrace(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.TRACE, + level: PREDEFINED_LOG_LEVELS.TRACE, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -140,7 +161,7 @@ class ReportPortalCucumberLoggerWorld { launchFatal(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.FATAL, + level: PREDEFINED_LOG_LEVELS.FATAL, message: logMessage, entity: RP_ENTITIES.LAUNCH, }), @@ -148,10 +169,21 @@ class ReportPortalCucumberLoggerWorld { ); } + scenarioLog(message, level) { + this.attach( + JSON.stringify({ + level, + message, + entity: RP_ENTITIES.SCENARIO, + }), + 'text/plain', + ); + } + scenarioInfo(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.INFO, + level: PREDEFINED_LOG_LEVELS.INFO, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), @@ -162,7 +194,7 @@ class ReportPortalCucumberLoggerWorld { scenarioDebug(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.DEBUG, + level: PREDEFINED_LOG_LEVELS.DEBUG, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), @@ -173,7 +205,7 @@ class ReportPortalCucumberLoggerWorld { scenarioError(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), @@ -184,7 +216,7 @@ class ReportPortalCucumberLoggerWorld { scenarioWarn(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.WARN, + level: PREDEFINED_LOG_LEVELS.WARN, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), @@ -195,7 +227,7 @@ class ReportPortalCucumberLoggerWorld { scenarioTrace(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.TRACE, + level: PREDEFINED_LOG_LEVELS.TRACE, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), @@ -206,7 +238,7 @@ class ReportPortalCucumberLoggerWorld { scenarioFatal(logMessage) { this.attach( JSON.stringify({ - level: LOG_LEVELS.FATAL, + level: PREDEFINED_LOG_LEVELS.FATAL, message: logMessage, entity: RP_ENTITIES.SCENARIO, }), diff --git a/package-lock.json b/package-lock.json index 7b74385..00f9584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "@reportportal/agent-js-cucumber", - "version": "5.6.0", + "version": "5.6.1", "license": "Apache-2.0", "dependencies": { "@reportportal/client-javascript": "~5.4.3", diff --git a/tests/cucumber-reportportal-formatter.spec.js b/tests/cucumber-reportportal-formatter.spec.js index 8a7c1ab..0c5a9ba 100644 --- a/tests/cucumber-reportportal-formatter.spec.js +++ b/tests/cucumber-reportportal-formatter.spec.js @@ -48,7 +48,7 @@ const { RP_EVENTS, RP_ENTITIES, TEST_STEP_FINISHED_RP_MESSAGES, - LOG_LEVELS, + PREDEFINED_LOG_LEVELS, } = require('../modules/constants'); describe('cucumber-reportportal-formatter', () => { @@ -599,7 +599,7 @@ describe('cucumber-reportportal-formatter', () => { expect(spySendLog).toHaveBeenCalledWith(stepTempId, { time: mockedDate, - level: LOG_LEVELS.DEBUG, + level: PREDEFINED_LOG_LEVELS.DEBUG, message: data.body, }); }); @@ -822,7 +822,7 @@ describe('cucumber-reportportal-formatter', () => { expect(spySendLog).toBeCalledWith('testItemId', { time: mockedDate, - level: LOG_LEVELS.WARN, + level: PREDEFINED_LOG_LEVELS.WARN, message: TEST_STEP_FINISHED_RP_MESSAGES.PENDING, }); }); @@ -837,7 +837,7 @@ describe('cucumber-reportportal-formatter', () => { expect(spySendLog).toBeCalledWith('testItemId', { time: mockedDate, - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: TEST_STEP_FINISHED_RP_MESSAGES.UNDEFINED, }); }); @@ -852,7 +852,7 @@ describe('cucumber-reportportal-formatter', () => { expect(spySendLog).toBeCalledWith('testItemId', { time: mockedDate, - level: LOG_LEVELS.ERROR, + level: PREDEFINED_LOG_LEVELS.ERROR, message: TEST_STEP_FINISHED_RP_MESSAGES.AMBIGUOUS, }); }); diff --git a/tests/loggerWorld.spec.js b/tests/loggerWorld.spec.js new file mode 100644 index 0000000..f310c3b --- /dev/null +++ b/tests/loggerWorld.spec.js @@ -0,0 +1,214 @@ +/* + * Copyright 2025 EPAM Systems + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const ReportPortalCucumberLoggerWorld = require('../modules/worlds/loggerWorld'); +const { PREDEFINED_LOG_LEVELS, RP_ENTITIES } = require('../modules/constants'); + +describe('ReportPortalCucumberLoggerWorld', () => { + let loggerWorld; + let attachSpy; + + beforeEach(() => { + attachSpy = jest.fn(); + loggerWorld = new ReportPortalCucumberLoggerWorld({ + attach: attachSpy, + parameters: {}, + }); + }); + + describe('info', () => { + it('should attach log with INFO level', () => { + const message = 'Test info message'; + loggerWorld.info(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.INFO, + message, + }), + 'text/plain', + ); + }); + }); + + describe('debug', () => { + it('should attach log with DEBUG level', () => { + const message = 'Test debug message'; + loggerWorld.debug(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.DEBUG, + message, + }), + 'text/plain', + ); + }); + }); + + describe('error', () => { + it('should attach log with ERROR level', () => { + const message = 'Test error message'; + loggerWorld.error(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.ERROR, + message, + }), + 'text/plain', + ); + }); + }); + + describe('warn', () => { + it('should attach log with WARN level', () => { + const message = 'Test warn message'; + loggerWorld.warn(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.WARN, + message, + }), + 'text/plain', + ); + }); + }); + + describe('trace', () => { + it('should attach log with TRACE level', () => { + const message = 'Test trace message'; + loggerWorld.trace(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.TRACE, + message, + }), + 'text/plain', + ); + }); + }); + + describe('fatal', () => { + it('should attach log with FATAL level', () => { + const message = 'Test fatal message'; + loggerWorld.fatal(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.FATAL, + message, + }), + 'text/plain', + ); + }); + }); + + describe('launchInfo', () => { + it('should attach log with INFO level and LAUNCH entity', () => { + const message = 'Test launch info message'; + loggerWorld.launchInfo(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.INFO, + message, + entity: RP_ENTITIES.LAUNCH, + }), + 'text/plain', + ); + }); + }); + + describe('scenarioInfo', () => { + it('should attach log with INFO level and SCENARIO entity', () => { + const message = 'Test scenario info message'; + loggerWorld.scenarioInfo(message); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: PREDEFINED_LOG_LEVELS.INFO, + message, + entity: RP_ENTITIES.SCENARIO, + }), + 'text/plain', + ); + }); + }); + + describe('custom log', () => { + it('should attach log with specified level and message', () => { + const message = 'Test custom message'; + const level = PREDEFINED_LOG_LEVELS.INFO; + loggerWorld.log(message, level); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level, + message, + }), + 'text/plain', + ); + }); + + it('should attach log with ERROR level', () => { + const message = 'Test error message'; + const level = PREDEFINED_LOG_LEVELS.ERROR; + loggerWorld.log(message, level); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level, + message, + }), + 'text/plain', + ); + }); + + it('should attach log with DEBUG level', () => { + const message = 'Test debug message'; + const level = PREDEFINED_LOG_LEVELS.DEBUG; + loggerWorld.log(message, level); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level, + message, + }), + 'text/plain', + ); + }); + + it('should accept all valid log levels', () => { + Object.keys(PREDEFINED_LOG_LEVELS).forEach((levelKey) => { + attachSpy.mockClear(); + const message = `Test message for ${levelKey}`; + loggerWorld.log(message, levelKey); + + expect(attachSpy).toHaveBeenCalledWith( + JSON.stringify({ + level: levelKey, + message, + }), + 'text/plain', + ); + }); + }); + }); +}); + From f1fba3212b1852f45a2dfe554d798b2ff927f45e Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Mon, 22 Dec 2025 13:07:24 +0400 Subject: [PATCH 5/6] Bump client-javascript to 5.5.8 --- package-lock.json | 168 ++++++++++++++++++---------------------------- package.json | 2 +- 2 files changed, 67 insertions(+), 103 deletions(-) diff --git a/package-lock.json b/package-lock.json index 00f9584..b1c9889 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "5.6.1", "license": "Apache-2.0", "dependencies": { - "@reportportal/client-javascript": "~5.4.3", + "@reportportal/client-javascript": "^5.5.8", "strip-ansi": "^6.0.1" }, "devDependencies": { @@ -1005,7 +1005,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", - "dev": true, "license": "MIT", "engines": { "node": "20 || >=22" @@ -1015,7 +1014,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", - "dev": true, "license": "MIT", "dependencies": { "@isaacs/balanced-match": "^4.0.1" @@ -1028,7 +1026,6 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, "license": "ISC", "dependencies": { "string-width": "^5.1.2", @@ -1046,7 +1043,6 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.0.tgz", "integrity": "sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -1059,14 +1055,12 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -1084,7 +1078,6 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -1587,15 +1580,18 @@ } }, "node_modules/@reportportal/client-javascript": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.4.3.tgz", - "integrity": "sha512-lERCUROcMqoyZjOibgzgjNz59IMdf9hVKcZfcVV3w1Ue7WoUIKmDnz0CVwX98BZGu2bNzNcr4j42cgb+qYL+ZQ==", + "version": "5.5.8", + "resolved": "https://registry.npmjs.org/@reportportal/client-javascript/-/client-javascript-5.5.8.tgz", + "integrity": "sha512-p91lp/ttV1YlhoDglsSIlTV1cSpCsqS4MsFcbe7i88sFlQqqiyWPjKnWHgIt4UK9jN2zJvAdxit5p1nyXQpiWw==", "license": "Apache-2.0", "dependencies": { "axios": "^1.12.2", "axios-retry": "^4.5.0", - "glob": "^8.1.0", + "glob": "^11.1.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", "ini": "^2.0.0", + "proxy-from-env": "^1.1.0", "uniqid": "^5.4.0", "uuid": "^9.0.1" }, @@ -1603,45 +1599,6 @@ "node": ">=14.x" } }, - "node_modules/@reportportal/client-javascript/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@reportportal/client-javascript/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@reportportal/client-javascript/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@rtsao/scc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", @@ -1842,6 +1799,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1898,7 +1864,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -2223,7 +2188,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/brace-expansion": { "version": "1.1.12", @@ -2507,7 +2473,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -2518,8 +2483,7 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/combined-stream": { "version": "1.0.8", @@ -2585,7 +2549,6 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -2651,7 +2614,6 @@ "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, "dependencies": { "ms": "^2.1.3" }, @@ -2792,7 +2754,6 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, "license": "MIT" }, "node_modules/electron-to-chromium": { @@ -2816,8 +2777,7 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/error-ex": { "version": "1.3.2", @@ -3618,7 +3578,6 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "dev": true, "license": "ISC", "dependencies": { "cross-spawn": "^7.0.6", @@ -3650,7 +3609,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -3795,15 +3755,14 @@ } }, "node_modules/glob": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", - "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", - "dev": true, - "license": "ISC", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", + "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "license": "BlueOak-1.0.0", "dependencies": { "foreground-child": "^3.3.1", "jackspeak": "^4.1.1", - "minimatch": "^10.0.3", + "minimatch": "^10.1.1", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" @@ -3831,11 +3790,10 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", - "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", - "dev": true, - "license": "ISC", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/brace-expansion": "^5.0.0" }, @@ -4045,6 +4003,32 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -4134,6 +4118,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -4142,7 +4127,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/ini": { "version": "2.0.0", @@ -4286,7 +4272,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -4493,8 +4478,7 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", @@ -4578,7 +4562,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -5483,7 +5466,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" @@ -5508,8 +5490,7 @@ "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/mz": { "version": "2.7.0", @@ -5701,6 +5682,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -5780,7 +5762,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, "license": "BlueOak-1.0.0" }, "node_modules/pad-right": { @@ -5847,7 +5828,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, "engines": { "node": ">=8" } @@ -5862,7 +5842,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^11.0.0", @@ -5879,7 +5858,6 @@ "version": "11.1.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", - "dev": true, "license": "ISC", "engines": { "node": "20 || >=22" @@ -6480,7 +6458,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -6492,7 +6469,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, "engines": { "node": ">=8" } @@ -6519,7 +6495,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, "license": "ISC", "engines": { "node": ">=14" @@ -6657,7 +6632,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -6672,7 +6646,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -6748,7 +6721,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -6761,7 +6733,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -7225,7 +7196,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -7284,7 +7254,6 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", @@ -7303,7 +7272,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -7321,7 +7289,6 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.0.tgz", "integrity": "sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -7334,7 +7301,6 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -7347,14 +7313,12 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, "license": "MIT" }, "node_modules/wrap-ansi/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -7372,7 +7336,6 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -7387,7 +7350,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.2", diff --git a/package.json b/package.json index 635754a..815c301 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test:coverage": "jest --coverage" }, "dependencies": { - "@reportportal/client-javascript": "~5.4.3", + "@reportportal/client-javascript": "^5.5.8", "strip-ansi": "^6.0.1" }, "engines": { From c62d3d4c387b64b2c10b87a3036c634de337a980 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian <164881199+maria-hambardzumian@users.noreply.github.com> Date: Mon, 5 Jan 2026 05:12:53 +0400 Subject: [PATCH 6/6] EPMRPP-111012 || Use skippedIsNotIssue from client (#190) * EPMRPP-111012 || Use skippedIsNotIssue from client * EPMRPP-111012 || Adjusted tests --------- Co-authored-by: maria-hambardzumian --- modules/cucumber-reportportal-formatter.js | 20 +++--- tests/cucumber-reportportal-formatter.spec.js | 61 +++++++------------ 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/modules/cucumber-reportportal-formatter.js b/modules/cucumber-reportportal-formatter.js index 9b340b3..b4e9be5 100644 --- a/modules/cucumber-reportportal-formatter.js +++ b/modules/cucumber-reportportal-formatter.js @@ -38,10 +38,16 @@ const createRPFormatterClass = (config) => this.options = options; this.config = config; - this.reportportal = new ReportPortalClient(config, { - name: pjson.name, - version: pjson.version, - }); + this.reportportal = new ReportPortalClient( + { + ...config, + skippedIsNotIssue: config.skippedIssue === false, + }, + { + name: pjson.name, + version: pjson.version, + }, + ); const { rerun, rerunOf } = options.parsedArgvOptions || {}; this.isRerun = rerun || config.rerun; this.rerunOf = rerunOf || config.rerunOf; @@ -105,10 +111,6 @@ const createRPFormatterClass = (config) => ...(this.config.attributes || []), { key: 'agent', value: `${pjson.name}|${pjson.version}`, system: true }, ]; - if (this.config.skippedIssue === false) { - const skippedIssueAttribute = { key: 'skippedIssue', value: 'false', system: true }; - attributes.push(skippedIssueAttribute); - } const startLaunchData = { name: this.config.launch, startTime: clientHelpers.now(), @@ -551,13 +553,11 @@ const createRPFormatterClass = (config) => const descriptionToSend = errorMessage ? `${description}${description ? '\n' : ''}${errorMessage}` : description; - const withoutIssue = status === STATUSES.SKIPPED && this.config.skippedIssue === false; this.reportportal.finishTestItem(tempStepId, { ...(status && { status }), ...(attributes && { attributes }), ...(descriptionToSend && { description: descriptionToSend }), ...(customTestCaseId && { testCaseId: customTestCaseId }), - ...(withoutIssue && { issue: { issueType: 'NOT_ISSUE' } }), endTime: clientHelpers.now(), }); } diff --git a/tests/cucumber-reportportal-formatter.spec.js b/tests/cucumber-reportportal-formatter.spec.js index 0c5a9ba..f4556c7 100644 --- a/tests/cucumber-reportportal-formatter.spec.js +++ b/tests/cucumber-reportportal-formatter.spec.js @@ -213,24 +213,6 @@ describe('cucumber-reportportal-formatter', () => { expect(formatter.storage.getLaunchTempId()).toBe('tempLaunchId'); }); - - it('startLaunch should be called with skippedIssue attribute', () => { - const tempId = 'test-temp-id'; - const spyStartLaunch = jest.spyOn(formatter.reportportal, 'startLaunch'); - const { skippedIssue } = formatter.config; - - formatter.config.skippedIssue = false; - formatter.onTestRunStartedEvent(); - formatter.config.skippedIssue = skippedIssue; - - expect(spyStartLaunch).toHaveBeenCalledWith( - expect.objectContaining({ - attributes: expect.arrayContaining([ - { key: 'skippedIssue', value: 'false', system: true }, - ]), - }), - ); - }); }); describe('onTestCaseEvent', () => { @@ -288,6 +270,25 @@ describe('cucumber-reportportal-formatter', () => { expect(formatter.storage.getRuleTempId()).toBe('testItemId'); }); + it('should handle rule flow when rule tempId already exists', () => { + formatter.onGherkinDocumentEvent(gherkinDocumentWithRule); + formatter.onPickleEvent(pickle); + formatter.onTestCaseEvent(testCase); + formatter.onTestRunStartedEvent(); + formatter.onTestCaseStartedEvent(testCaseStarted); + + // eslint-disable-next-line global-require + const ruleTempId = formatter.storage.getRuleTempId(require('./data').ruleId); + formatter.onTestCaseEvent({ ...testCase, id: 'second-test-case-id' }); + formatter.onTestCaseStartedEvent({ + testCaseId: 'second-test-case-id', + id: 'second-test-case-started-id', + timestamp: { seconds: 1654094464, nanos: 288000000 }, + }); + + expect(formatter.storage.getRuleTempIdToTestCase('second-test-case-id')).toBe(ruleTempId); + }); + it('startTestItem should be called', () => { const spyStartTestItem = jest.spyOn(formatter.reportportal, 'startTestItem'); @@ -315,8 +316,7 @@ describe('cucumber-reportportal-formatter', () => { }); it('should set isRetry for test case in storage if attempt > 0', () => { - const spyStartTestItem = jest.spyOn(formatter.reportportal, 'startTestItem'); - + jest.spyOn(formatter.reportportal, 'startTestItem'); formatter.onTestCaseStartedEvent({ ...testCaseStarted, attempt: 1 }); expect(formatter.storage.getTestCase(testCaseId).isRetry).toEqual(true); @@ -771,37 +771,22 @@ describe('cucumber-reportportal-formatter', () => { expect(formatter.storage.getStepTempId(testStepStarted.testStepId)).toBeUndefined(); }); - it('finishTestItem should be called with unexpected status', () => { + it('finishTestItem should be called with skipped status', () => { const spyfinishTestItem = jest.spyOn(formatter.reportportal, 'finishTestItem'); formatter.onTestStepFinishedEvent({ ...testStepFinished, - testStepResult: { ...testStepFinished.testStepResult, status: 'unexpected-status' }, + testStepResult: { ...testStepFinished.testStepResult, status: STATUSES.SKIPPED }, }); expect(spyfinishTestItem).toBeCalledWith( 'testItemId', expect.objectContaining({ - status: 'unexpected-status', + status: STATUSES.SKIPPED, }), ); }); - it('finishTestItem should be called with NOT_ISSUE type if SKIPPED status and skippedIssue set to false', () => { - const spyfinishTestItem = jest.spyOn(formatter.reportportal, 'finishTestItem'); - - formatter.config.skippedIssue = false; - formatter.onTestStepFinishedEvent({ - ...testStepFinished, - testStepResult: { ...testStepFinished.testStepResult, status: STATUSES.SKIPPED }, - }); - - expect(spyfinishTestItem).toBeCalledWith( - 'testItemId', - expect.objectContaining({ status: STATUSES.SKIPPED, issue: { issueType: 'NOT_ISSUE' } }), - ); - }); - it('should set failed status for test case in storage if isScenarioBasedStatistics === true', () => { const originIsScenarioBasedStatistics = formatter.isScenarioBasedStatistics; formatter.isScenarioBasedStatistics = true;