Skip to content

Commit dbd5341

Browse files
authored
Merge pull request #128 from reportportal/develop
Release 5.0.6
2 parents 9522a58 + c10f04d commit dbd5341

18 files changed

+2951
-2931
lines changed

.eslintrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"extends": "airbnb-base",
2+
"extends": [
3+
"airbnb-base",
4+
"plugin:prettier/recommended",
5+
"plugin:import/recommended"
6+
],
7+
"plugins": ["prettier"],
38
"globals": {
49
"expectAsync": true
510
},
@@ -8,7 +13,6 @@
813
"es6": true
914
},
1015
"rules": {
11-
"indent": ["error", 4],
1216
"max-len": ["error", 120],
1317
"valid-jsdoc": ["error", { "requireReturn": false }],
1418
"consistent-return": 0,

.github/workflows/CI-pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1616
- name: Set up Node.js
17-
uses: actions/setup-node@v2
17+
uses: actions/setup-node@v3
1818
with:
1919
node-version: 18
20-
- name: Clean install of node dependencies
21-
run: npm ci
20+
- name: Install of node dependencies
21+
run: npm install
2222
- name: Run lint
2323
run: npm run lint
2424
- name: Run tests and check coverage

.github/workflows/publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout repository
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313
- name: Set up Node.js
14-
uses: actions/setup-node@v2
14+
uses: actions/setup-node@v3
1515
with:
1616
node-version: 18
17-
- name: Clean install of node dependencies
18-
run: npm ci
17+
- name: Install of node dependencies
18+
run: npm install
1919
- name: Run lint
2020
run: npm run lint
2121
- name: Run tests and check coverage
@@ -26,14 +26,14 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3030
- name: Set up Node.js
31-
uses: actions/setup-node@v2
31+
uses: actions/setup-node@v3
3232
with:
3333
node-version: 18
3434
registry-url: 'https://registry.npmjs.org'
35-
- name: Clean install of node dependencies
36-
run: npm ci
35+
- name: Install of node dependencies
36+
run: npm install
3737
- name: Publish to NPM
3838
run: |
3939
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
@@ -42,7 +42,7 @@ jobs:
4242
env:
4343
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
4444
- name: Set up Node.js
45-
uses: actions/setup-node@v2
45+
uses: actions/setup-node@v3
4646
with:
4747
node-version: 18
4848
registry-url: 'https://npm.pkg.github.com'

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"arrowParens": "always",
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"printWidth": 100
6+
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Changed
2+
- `token` configuration option was renamed to `apiKey` to maintain common convention.
3+
- `@reportportal/client-javascript` bumped to version `5.0.12`.
4+
- Readme file updated.
15

26
## [5.0.5] - 2023-03-16
37
### Added

README.md

Lines changed: 90 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,49 @@
11
# @reportportal/agent-js-jest
22

3-
A Jest reporter that uploads the results to a [ReportPortal](http://reportportal.io/) server.
3+
Agent to integrate Jest with ReportPortal.
4+
* More about [Jest](https://jestjs.io/)
5+
* More about [ReportPortal](http://reportportal.io/)
46

57
## Installation
68

79
```shell
810
npm install --save-dev @reportportal/agent-js-jest
911
```
1012

11-
## Usage
13+
## Configuration
1214

13-
In your jest config section of `package.json`, add the following entry:
15+
**1.** Create `jest.config.js` file with reportportal configuration:
16+
```javascript
17+
module.exports = {
18+
testRunner: 'jest-circus/runner',
19+
testRegex: ['/__tests__/.*.spec.js?$'],
20+
reporters: [
21+
'default',
22+
[
23+
'@reportportal/agent-js-jest',
24+
{
25+
apiKey: 'reportportalApiKey',
26+
endpoint: 'https://your.reportportal.server/api/v1',
27+
project: 'Your reportportal project name',
28+
launch: 'Your launch name',
29+
attributes: [
30+
{
31+
key: 'key',
32+
value: 'value',
33+
},
34+
{
35+
value: 'value',
36+
},
37+
],
38+
description: 'Your launch description',
39+
}
40+
]
41+
],
42+
...
43+
};
44+
```
45+
46+
In case you use the jest config section of `package.json`, add the following entry:
1447

1548
```JSON
1649
{
@@ -20,146 +53,78 @@ In your jest config section of `package.json`, add the following entry:
2053
"default",
2154
["@reportportal/agent-js-jest",
2255
{
23-
"token": "00000000-0000-0000-0000-000000000000",
56+
"token": "reportportalApiKey",
2457
"endpoint": "https://your.reportportal.server/api/v1",
25-
"project": "YourReportPortalProjectName",
26-
"launch": "YourLauncherName",
27-
"description": "YourDescription",
28-
"logLaunchLink": true,
58+
"project": "Your reportportal project name",
59+
"launch": "Your launch name",
2960
"attributes": [
3061
{
31-
"key": "YourKey",
32-
"value": "YourValue"
62+
"key": "key",
63+
"value": "value"
3364
},
3465
{
35-
"value": "YourValue"
36-
},
66+
"value": "value"
67+
}
3768
],
38-
"restClientConfig": {
39-
"timeout": 0
40-
}
69+
"description": "Your launch description"
4170
}]
4271
],
4372
...
4473
}
4574
}
4675
```
4776

48-
In case you use `jest.config.js`, you should add to it the following:
49-
50-
```javascript
51-
52-
module.exports = {
53-
...
54-
reporters: [
55-
"default",
56-
[
57-
"@reportportal/agent-js-jest",
58-
{
59-
"token": "00000000-0000-0000-0000-000000000000",
60-
"endpoint": "https://your.reportportal.server/api/v1",
61-
"project": "YourReportPortalProjectName",
62-
"launch": "YourLauncherName",
63-
"description": "YourDescription",
64-
"logLaunchLink": true,
65-
"attributes": [
66-
{
67-
"key": "YourKey",
68-
"value": "YourValue"
69-
},
70-
{
71-
"value": "YourValue"
72-
},
73-
]
74-
}
75-
]
76-
]
77-
...
78-
```
79-
80-
It's possible by using environment variables, it's important to mention that environment variables has precedence over `package.json` definition.
81-
82-
```shell
83-
$ export RP_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
84-
$ export RP_PROJECT_NAME=MY_AWESOME_PROJECT
85-
$ export RP_ENDPOINT=MY_RP_ENDPOINT
86-
$ export RP_LAUNCH=MY_COOL_LAUNCHER
87-
$ export RP_DESCRIPTION=RP_DESCRIPTION
88-
$ export RP_ATTRIBUTES=key:value,key:value,value
89-
$ export RP_LAUNCH_ID=EXIST_LAUNCH_ID
90-
$ export RP_MODE=DEBUG
91-
```
92-
93-
This for your convenience in case you has a continuous job that run your tests and may post the results pointing to a different Report Portal definition of project, launcher name or tags.
94-
95-
## Disable the colors of test output:
96-
97-
In the Report Portal, the output of the test results may contain ANSI character set, this may be caused by the color setting in Jest. For version `"jest": "^24.8.0"`, use `jest --no-colors` command to disable the colors of test output.
98-
99-
## Used to report retry of test:
100-
101-
The agent supports of Retries.
102-
Read more about [retries in jest](https://jestjs.io/docs/ru/jest-object#jestretrytimes).
103-
104-
## Rerun:
105-
106-
To report [rerun](https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/rerun.md) to the report portal you need to specify the following options:
107-
108-
- rerun - to enable rerun
109-
- rerunOf - UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name
110-
111-
Example:
112-
113-
```json
114-
"rerun": true,
115-
"rerunOf": "f68f39f9-279c-4e8d-ac38-1216dffcc59c"
116-
```
117-
118-
## Skipped issue:
119-
120-
_Default: true._ ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side.<br> Parameter could be equal boolean values:<br> _TRUE_ - skipped tests considered as issues and will be marked as 'To Investigate' on Report Portal.<br> _FALSE_ - skipped tests will not be marked as 'To Investigate' on application.
121-
122-
Example:
123-
124-
```json
125-
"skippedIssue": false
126-
```
127-
128-
## Launch mode:
129-
130-
Launch mode. Allowable values _DEFAULT_ (by default) or _DEBUG_.
131-
132-
Example:
133-
134-
```json
135-
"mode": "DEBUG"
136-
```
137-
138-
## Debug flag:
139-
140-
This flag allows seeing the logs of the client-javascript. Useful for debugging an agent.
141-
142-
Example:
143-
77+
The full list of available options presented below.
78+
79+
| Option | Necessity | Default | Description |
80+
|------------------|------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
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. |
82+
| endpoint | Required | | URL of your server. For example 'https://server:8080/api/v1'. |
83+
| launch | Required | | Name of launch at creation. |
84+
| project | Required | | The name of the project in which the launches will be created. |
85+
| attributes | Optional | [] | Launch attributes. |
86+
| description | Optional | '' | Launch description. |
87+
| rerun | Optional | false | Enable [rerun](https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/rerun.md) |
88+
| rerunOf | Optional | Not set | UUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name |
89+
| mode | Optional | 'DEFAULT' | Results will be submitted to Launches page <br/> *'DEBUG'* - Results will be submitted to Debug page. |
90+
| skippedIssue | Optional | true | reportportal provides feature to mark skipped tests as not 'To Investigate'. <br/> Option could be equal boolean values: <br/> *true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal. <br/> *false* - skipped tests will not be marked as 'To Investigate' on application. |
91+
| debug | Optional | false | This flag allows seeing the logs of the client-javascript. Useful for debugging. |
92+
| launchId | Optional | Not set | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately. |
93+
| logLaunchLink | Optional | false | This flag allows print the URL of the Launch of the tests in console. |
94+
| restClientConfig | Optional | Not set | The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. [`timeout`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests). <br/> Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. |
95+
| token | Deprecated | Not set | Use `apiKey` instead. |
96+
97+
The following options can be overridden using ENVIRONMENT variables:
98+
99+
| Option | ENV variable | Note |
100+
|-------------|-----------------|----------------------------------------|
101+
| apiKey | RP_API_KEY ||
102+
| project | RP_PROJECT_NAME ||
103+
| endpoint | RP_ENDPOINT ||
104+
| launch | RP_LAUNCH | |
105+
| attributes | RP_ATTRIBUTES | *Format:* key:value,key:value,value |
106+
| description | RP_DESCRIPTION ||
107+
| launchId | RP_LAUNCH_ID | |
108+
| mode | RP_MODE ||
109+
| token | RP_TOKEN | *deprecated* Use `RP_API_KEY` instead. |
110+
111+
This is for your convenience if you have a continuous job that runs your tests and may report results that point to a different reportportal project definition, launch name, or attributes.
112+
113+
**2.** Add script to `package.json` file:
144114
```json
145-
"debug": true
115+
{
116+
"scripts": {
117+
"test": "jest --no-colors --detectOpenHandles --config ./jest.config.js"
118+
}
119+
}
146120
```
147121

148-
## LogLaunchLink flag:
149-
150-
This flag allows print the URL of the Launch of the tests in console.
151-
152-
Example:
153-
154-
```json
155-
"logLaunchLink": true
156-
```
122+
## Features
157123

158-
## REST Client config:
124+
### Retries
159125

160-
Optional property.<br/>
161-
The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`.<br/>
162-
Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details.
126+
The agent has support of retries.
127+
Read more about [retries in jest](https://jestjs.io/ru/docs/jest-object#jestretrytimesnumretries-options).
163128

164129
# Copyright Notice
165130

VERSION

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

0 commit comments

Comments
 (0)