Skip to content

Commit c225d2a

Browse files
authored
Merge pull request #165 from reportportal/develop
Release 5.2.1
2 parents c907ec9 + 0d30f7c commit c225d2a

File tree

7 files changed

+894
-354
lines changed

7 files changed

+894
-354
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
### Added
2+
- OAuth 2.0 Password Grant authentication, check [Authentication Options](https://github.com/reportportal/agent-js-jest?tab=readme-ov-file#authentication-options) for more details.
3+
### Changed
4+
- `@reportportal/client-javascript` bumped to version `5.4.3`.
15

26
## [5.2.0] - 2025-10-09
37
### Added
48
- Allow configuring the HTTP retry strategy via `restClientConfig.retry` and tune the [default policy](https://github.com/reportportal/client-javascript?tab=readme-ov-file#retry-configuration).
59
- New `launchUuidPrintOutput` types introduced: 'FILE', 'ENVIRONMENT'.
610
### Changed
711
- **Breaking change** Drop support of Node.js 12. The version [5.1.3](https://github.com/reportportal/agent-js-jest/releases/tag/v5.1.3) is the latest that supports it.
8-
- `@reportportal/client-javascript` bumped to version `5.4.2.
12+
- `@reportportal/client-javascript` bumped to version `5.4.2`.
913
### Security
1014
- Updated versions of vulnerable packages (brace-expansion, axios, form-data).
1115
### Deprecated

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
'@reportportal/agent-js-jest',
2424
{
2525
apiKey: 'reportportalApiKey',
26-
endpoint: 'https://your.reportportal.server/api/v1',
26+
endpoint: 'https://your.reportportal.server/api/v2',
2727
project: 'Your reportportal project name',
2828
launch: 'Your launch name',
2929
attributes: [
@@ -54,7 +54,7 @@ In case you use the jest config section of `package.json`, add the following ent
5454
["@reportportal/agent-js-jest",
5555
{
5656
"token": "reportportalApiKey",
57-
"endpoint": "https://your.reportportal.server/api/v1",
57+
"endpoint": "https://your.reportportal.server/api/v2",
5858
"project": "Your reportportal project name",
5959
"launch": "Your launch name",
6060
"attributes": [
@@ -76,9 +76,58 @@ In case you use the jest config section of `package.json`, add the following ent
7676

7777
The full list of available options presented below.
7878

79+
### Authentication Options
80+
81+
The agent supports two authentication methods:
82+
1. **API Key Authentication** (default)
83+
2. **OAuth 2.0 Password Grant** (recommended for enhanced security)
84+
85+
**Note:**\
86+
If both authentication methods are provided, OAuth 2.0 will be used.\
87+
Either API key or complete OAuth 2.0 configuration is required to connect to ReportPortal.
88+
89+
| Option | Necessity | Default | Description |
90+
|--------|-------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
91+
| apiKey | Conditional | | User's ReportPortal API key from which you want to send requests. It can be found on the profile page of this user. *Required only if OAuth is not configured. |
92+
| oauth | Conditional | | OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key. See OAuth Configuration below. |
93+
94+
#### OAuth Configuration
95+
96+
The `oauth` object supports the following properties:
97+
98+
| Property | Necessity | Default | Description |
99+
|-----------------------|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
100+
| tokenEndpoint | Required | | OAuth 2.0 token endpoint URL for password grant flow. |
101+
| username | Required | | Username for OAuth 2.0 password grant. |
102+
| password | Required | | Password for OAuth 2.0 password grant. |
103+
| clientId | Required | | OAuth 2.0 client ID. |
104+
| clientSecret | Optional | | OAuth 2.0 client secret (optional, depending on your OAuth server configuration). |
105+
| scope | Optional | | OAuth 2.0 scope (optional, space-separated list of scopes). |
106+
107+
**Note:** The OAuth interceptor automatically handles token refresh when the token is about to expire (1 minute before expiration).
108+
109+
##### OAuth 2.0 configuration example
110+
111+
```javascript
112+
const rpConfig = {
113+
endpoint: 'https://your.reportportal.server/api/v2',
114+
project: 'Your reportportal project name',
115+
launch: 'Your launch name',
116+
oauth: {
117+
tokenEndpoint: 'https://your-oauth-server.com/oauth/token',
118+
username: 'your-username',
119+
password: 'your-password',
120+
clientId: 'your-client-id',
121+
clientSecret: 'your-client-secret', // optional
122+
scope: 'reportportal', // optional
123+
}
124+
};
125+
```
126+
127+
### General options
128+
79129
| Option | Necessity | Default | Description |
80130
|------------------------------------|-----------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
81-
| apiKey | Required | | User's reportportal token from which you want to send requests. It can be found on the profile page of this user. |
82131
| endpoint | Required | | URL of your server. For example 'https://server:8080/api/v1'. Use `api/v2` for asynchronous reporting. |
83132
| launch | Required | | Name of launch at creation. |
84133
| project | Required | | The name of the project in which the launches will be created. |
@@ -120,6 +169,13 @@ This is for your convenience if you have a continuous job that runs your tests a
120169
}
121170
```
122171

172+
## Asynchronous API
173+
174+
The client supports an asynchronous reporting (via the ReportPortal asynchronous API).
175+
If you want the client to report through the asynchronous API, change `v1` to `v2` in the `endpoint` address.
176+
177+
**Note:** It is highly recommended to use the `v2` endpoint for reporting, especially for extensive test suites.
178+
123179
## Features
124180

125181
### Retries
@@ -326,7 +382,7 @@ mergeLaunches();
326382
```
327383

328384
Using a merge operation for huge launches can increase the load on ReportPortal's API.
329-
See the details and other parameters available for merge operation in [ReportPortal API docs](https://developers.reportportal.io/api-docs/service-api/merge-launches-1).
385+
See the details and other parameters available for merge operation in [ReportPortal API docs](https://developers.reportportal.io/api-docs/service-api/versions/5.13/merge-launches-old-uuid-2).
330386

331387
**Note:** Since the options described require additional effort, the ReportPortal team intends to create a CLI for them to make them easier to use, but with no ETA.
332388
Progress can be tracked in this [issue](https://github.com/reportportal/client-javascript/issues/218).

VERSION

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

0 commit comments

Comments
 (0)