Skip to content

Commit 709b770

Browse files
authored
Merge pull request #249 from reportportal/develop
Release 5.5.8
2 parents 2cbe422 + 6fcecea commit 709b770

11 files changed

Lines changed: 148 additions & 4 deletions

File tree

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"es6": true,
2020
"jest": true
2121
},
22+
"ignorePatterns": ["__tests__/**/*"],
2223
"rules": {
2324
"valid-jsdoc": ["error", { "requireReturn": false }],
2425
"consistent-return": 0,

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Added
2+
- `skippedIsNotIssue` option to not mark skipped tests as 'To Investigate' in ReportPortal.
3+
### Fixed
4+
- Error for empty `restClientConfig` while using HTTP retries.
15

26
## [5.5.7] - 2025-12-09
37
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ rpClient.checkConnect().then(() => {
122122
| restClientConfig | Optional | Not set | Check the details in the [HTTP client config](#http-client-options). |
123123
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
124124
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
125-
| token | Deprecated | Not set | Use `apiKey` or `oauth` instead. |
125+
| skippedIsNotIssue | Optional | False | ReportPortal provides feature to mark skipped tests as not 'To Investigate'. Option could be equal boolean values: `true` - skipped tests will not be marked as 'To Investigate' on application. `false` - skipped tests considered as issues and will be marked as 'To Investigate' on application. |
126126

127127
### HTTP client options
128128

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.5.7
1+
5.5.8-SNAPSHOT

__tests__/report-portal-client.spec.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,108 @@ describe('ReportPortal javascript client', () => {
876876
});
877877
});
878878

879+
it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is true', function (done) {
880+
const mockClient = new RPClient(
881+
{
882+
apiKey: 'test',
883+
endpoint: 'https://reportportal-stub-url',
884+
launch: 'test launch',
885+
project: 'test project',
886+
skippedIsNotIssue: true,
887+
},
888+
{ name: 'test', version: '1.0.0' },
889+
);
890+
891+
const spyFinishTestItemPromiseStart = jest
892+
.spyOn(mockClient, 'finishTestItemPromiseStart')
893+
.mockImplementation(() => {});
894+
895+
mockClient.map = {
896+
testItemId: {
897+
children: [],
898+
finishSend: false,
899+
promiseFinish: Promise.resolve(),
900+
resolveFinish: () => {},
901+
},
902+
};
903+
904+
const finishTestItemRQ = {
905+
status: 'skipped',
906+
};
907+
908+
mockClient.finishTestItem('testItemId', finishTestItemRQ);
909+
910+
setTimeout(() => {
911+
try {
912+
expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith(
913+
expect.any(Object),
914+
'testItemId',
915+
expect.objectContaining({
916+
status: 'skipped',
917+
issue: { issueType: 'NOT_ISSUE' },
918+
}),
919+
);
920+
done();
921+
} catch (error) {
922+
done(error);
923+
}
924+
}, 50);
925+
});
926+
927+
it('should not add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is false', function (done) {
928+
const mockClient = new RPClient(
929+
{
930+
apiKey: 'test',
931+
endpoint: 'https://reportportal-stub-url',
932+
launch: 'test launch',
933+
project: 'test project',
934+
skippedIsNotIssue: false,
935+
},
936+
{ name: 'test', version: '1.0.0' },
937+
);
938+
939+
const spyFinishTestItemPromiseStart = jest
940+
.spyOn(mockClient, 'finishTestItemPromiseStart')
941+
.mockImplementation(() => {});
942+
943+
mockClient.map = {
944+
testItemId: {
945+
children: [],
946+
finishSend: false,
947+
promiseFinish: Promise.resolve(),
948+
resolveFinish: () => {},
949+
},
950+
};
951+
952+
const finishTestItemRQ = {
953+
status: 'skipped',
954+
};
955+
956+
mockClient.finishTestItem('testItemId', finishTestItemRQ);
957+
958+
setTimeout(() => {
959+
try {
960+
expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith(
961+
expect.any(Object),
962+
'testItemId',
963+
expect.objectContaining({
964+
status: 'skipped',
965+
}),
966+
);
967+
expect(spyFinishTestItemPromiseStart).not.toHaveBeenCalledWith(
968+
expect.any(Object),
969+
'testItemId',
970+
expect.objectContaining({
971+
issue: expect.anything(),
972+
}),
973+
);
974+
done();
975+
} catch (error) {
976+
done(error);
977+
}
978+
}, 100);
979+
});
980+
879981
describe('saveLog', () => {
880982
it('should return object with tempId and promise', () => {
881983
const client = new RPClient({ apiKey: 'any', endpoint: 'https://rp.api', project: 'prj' });

__tests__/rest.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,26 @@ describe('RestClient', () => {
134134
};
135135
expect(retryConfig.retryCondition(timeoutError)).toBe(true);
136136
});
137+
138+
it('handles undefined restClientConfig without crashing during retries', () => {
139+
const client = new RestClient({
140+
baseURL: options.baseURL,
141+
headers: options.headers,
142+
restClientConfig: undefined,
143+
});
144+
145+
const retryConfig = client.getRetryConfig();
146+
expect(retryConfig.retries).toBe(6);
147+
148+
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
149+
const onRetry = retryConfig.onRetry;
150+
151+
expect(() => {
152+
onRetry(1, { code: 'ECONNABORTED' }, { method: 'GET', url: 'http://test.com' });
153+
}).not.toThrow();
154+
155+
consoleSpy.mockRestore();
156+
});
137157
});
138158

139159
describe('buildPath', () => {

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ declare module '@reportportal/client-javascript' {
155155
launchUuidPrintOutput?: string;
156156
restClientConfig?: RestClientConfig;
157157
token?: string;
158+
skippedIsNotIssue?: boolean;
158159
/**
159160
* OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key.
160161
*/

lib/commons/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const getClientConfig = (options) => {
115115
description: options.description,
116116
launchUuidPrint: options.launchUuidPrint,
117117
launchUuidPrintOutput,
118+
skippedIsNotIssue: !!options.skippedIsNotIssue,
118119
};
119120
} catch (error) {
120121
// don't throw the error up to not break the entire process

lib/report-portal-client.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ class RPClient {
202202
this.launchUuid = launchDataRQ.id;
203203
} else {
204204
const systemAttr = helpers.getSystemAttribute();
205+
if (this.config.skippedIsNotIssue === true) {
206+
const skippedIsNotIssueAttribute = {
207+
key: 'skippedIssue',
208+
value: 'false',
209+
system: true,
210+
};
211+
systemAttr.push(skippedIsNotIssueAttribute);
212+
}
205213
const attributes = Array.isArray(launchDataRQ.attributes)
206214
? launchDataRQ.attributes.concat(systemAttr)
207215
: systemAttr;
@@ -612,6 +620,13 @@ class RPClient {
612620
...finishTestItemRQ,
613621
};
614622

623+
if (
624+
finishTestItemData.status === RP_STATUSES.SKIPPED &&
625+
this.config.skippedIsNotIssue === true
626+
) {
627+
finishTestItemData.issue = { issueType: 'NOT_ISSUE' };
628+
}
629+
615630
itemObj.finishSend = true;
616631
this.logDebug(`Finish all children for test item with tempId ${itemTempId}`);
617632
Promise.allSettled(

lib/rest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ method: ${method}`,
150150
getRetryConfig() {
151151
const retryOption = this.restClientConfig?.retry;
152152
const onRetry = (retryCount, error, requestConfig) => {
153-
if (this.restClientConfig.debug) {
153+
if (this.restClientConfig?.debug) {
154154
console.log(`[retry #${retryCount}] ${requestConfig.method?.toUpperCase()} ${requestConfig.url} -> ${error.code || error.message}`);
155155
}
156156
};

0 commit comments

Comments
 (0)