jest-qase-reporter 1.3.0-alpha.4 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ But if necessary, you can independently register the ID of already
17
17
  existing test cases from TMS before the executing tests. For example:
18
18
 
19
19
  ```typescript
20
- import { qase } from 'jest-qase-reporter/dist/jest';
20
+ import { qase } from 'jest-qase-reporter/jest';
21
21
 
22
22
  describe('My First Test', () => {
23
23
  test(qase([1,2], 'Several ids'), () => {
@@ -37,29 +37,21 @@ describe('My First Test', () => {
37
37
  })
38
38
  });
39
39
  ```
40
-
41
- You should also have an active item in the project settings at
42
-
40
+ To run tests and create a test run, execute the command (for example from folder examples):
41
+ ```bash
42
+ QASE_MODE=testops npx jest
43
43
  ```
44
- https://app.qase.io/project/QASE_PROJECT_CODE/settings/options
44
+ or
45
+ ```bash
46
+ npm test
45
47
  ```
46
48
 
47
- options in the `Test Runs` block:
49
+ <p align="center">
50
+ <img width="65%" src="./screenshots/screenshot.png">
51
+ </p>
48
52
 
49
- ```
50
- Auto create test cases
51
- ```
52
- and
53
- ```
54
- Allow submitting results in bulk
55
- ```
56
-
57
- To run tests and create a test run, execute the command:
58
- ```bash
59
- QASE_REPORT=1 npx jest
60
- ```
61
- ![Output of run](examples/screenshots/screenshot.png)​
62
53
  A test run will be performed and available at:
54
+
63
55
  ```
64
56
  https://app.qase.io/run/QASE_PROJECT_CODE
65
57
  ```
@@ -68,15 +60,18 @@ https://app.qase.io/run/QASE_PROJECT_CODE
68
60
 
69
61
  Reporter options (* - required):
70
62
 
71
- - *`apiToken` - Token for API access, you can find more information
63
+ - `mode` - `testops`/`off` Enables reporter, default - `off`
64
+ - `debug` - Enables debug logging, defaule - `false`
65
+ - `environment` - To execute with the sending of the envinroment information
66
+ - *`testops.api.token` - Token for API access, you can find more information
72
67
  [here](https://developers.qase.io/#authentication)
73
- - *`projectCode` - Code of your project (can be extracted from main
74
- page of your project: `https://app.qase.io/project/DEMOTR` -
68
+ - *`testops.project` - Code of your project (can be extracted from main
69
+ page of your project: `https://app.qase.io/project/DEMOTR` -
75
70
  `DEMOTR` is project code here)
76
- - `runId` - Run ID from Qase TMS (also can be got from run URL)
77
- - `environmentId` - Environment ID from Qase TMS
78
- - `logging` [true/false] - Enabled debug logging from reporter or not
79
- - `runComplete` [true/false] - Complete run after all tests are finished
71
+ - `testops.run.id` - Pass Run ID
72
+ - `testops.run.title` - Set custom Run name, when new run is created
73
+ - `testops.run.description` - Set custom Run description, when new run is created
74
+ - `testops.run.complete` - Whether the run should be completed
80
75
 
81
76
  Example `jest.config.js` config:
82
77
 
@@ -87,12 +82,18 @@ module.exports = {
87
82
  [
88
83
  'jest-qase-reporter',
89
84
  {
90
- apiToken: 'api_key',
91
- projectCode: 'project_code',
92
- runId: 45,
93
- environmentId: 1,
94
- logging: true,
95
- runComplete: true,
85
+ debug: true,
86
+ environment: 1,
87
+ testops: {
88
+ api: {
89
+ token: 'api_key'
90
+ },
91
+ project: 'project_code',
92
+ run: {
93
+ id: 45,
94
+ complete: true,
95
+ },
96
+ },
96
97
  },
97
98
  ],
98
99
  ],
@@ -100,20 +101,24 @@ module.exports = {
100
101
  };
101
102
  ```
102
103
 
103
- You can check example configuration with multiple reporters in [example project](./examples/jest.config.js).
104
+ You can check example configuration with multiple reporters in [example project](../examples/jest/jest.config.js).
104
105
 
105
106
  Supported ENV variables:
106
107
 
107
- - `QASE_REPORT` - You **should** pass this ENV if you want to use
108
- qase reporter
109
- - `QASE_API_TOKEN` - API token
110
- - `QASE_PROJECT_CODE` - Your project code
111
- - `QASE_ROOT_SUITE_TITLE` - Setting the root suite that the reporter will use
112
- - `QASE_RUN_ID` - Pass Run ID from ENV and override reporter options
113
- - `QASE_ENVIRONMENT_ID` - Pass Environment ID from ENV and override reporter options
114
- - `QASE_RUN_NAME` - Set custom Run name, when new run is created
115
- - `QASE_RUN_DESCRIPTION` - Set custom Run description, when new run is created
116
- - `QASE_RUN_COMPLETE` - Complete run after all tests are finished
108
+ - `QASE_MODE` - Same as `mode`
109
+ - `QASE_DEBUG` - Same as `debug`
110
+ - `QASE_ENVIRONMENT` - Same as `environment`
111
+ - `QASE_TESTOPS_API_TOKEN` - Same as `testops.api.token`
112
+ - `QASE_TESTOPS_PROJECT` - Same as `testops.project`
113
+ - `QASE_TESTOPS_RUN_ID` - Pass Run ID from ENV and override reporter option `testops.run.id`
114
+ - `QASE_TESTOPS_RUN_TITLE` - Same as `testops.run.title`
115
+ - `QASE_TESTOPS_RUN_DESCRIPTION` - Same as `testops.run.description`
116
+
117
+ ## Requirements
118
+
119
+ We maintain the reporter on LTS versions of Node. You can find the current versions by following the [link](https://nodejs.org/en/about/releases/)
120
+
121
+ `jest >= 28.0.0`
117
122
 
118
123
  <!-- references -->
119
124
 
package/package.json CHANGED
@@ -1,55 +1,64 @@
1
1
  {
2
2
  "name": "jest-qase-reporter",
3
- "version": "v1.3.0-alpha.4",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Qase TMS Jest Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./jest": "./dist/jest.js",
10
+ "./reporter": "./dist/reporter.js",
11
+ "./package.json": "./package.json"
12
+ },
13
+ "typesVersions": {
14
+ "*": {
15
+ ".": [
16
+ "./dist/index.d.ts"
17
+ ],
18
+ "jest": [
19
+ "./dist/jest.d.ts"
20
+ ],
21
+ "reporter": [
22
+ "./dist/reporter.d.ts"
23
+ ]
24
+ }
25
+ },
7
26
  "homepage": "https://github.com/qase-tms/qase-javascript",
8
27
  "bugs": {
9
28
  "url": "https://github.com/qase-tms/qase-javascript/issues"
10
29
  },
11
30
  "repository": {
12
31
  "type": "git",
13
- "url": "https://github.com/qase-tms/qase-javascript.git"
32
+ "url": "git+https://github.com/qase-tms/qase-javascript.git"
14
33
  },
15
34
  "engines": {
16
- "node": ">=10"
35
+ "node": ">=14"
17
36
  },
18
37
  "scripts": {
19
- "dev": "npm run lint && tsc",
20
- "dev:watch": "nodemon --exec 'npm run dev || exit 1'",
21
- "lint": "eslint src/**",
22
- "lint:fix": "eslint --fix src/**",
23
- "build": "npm run clean && npm run dev",
24
- "test": "jest --coverage",
25
- "clean": "rm -rf dist || true"
26
- },
27
- "author": {
28
- "name": "Parviz Khavari",
29
- "email": "csctclan@gmail.com"
38
+ "build": "npm run clean && tsc --project tsconfig.build.json",
39
+ "lint": "eslint .",
40
+ "test": "jest --passWithNoTests",
41
+ "clean": "rm -rf dist"
30
42
  },
43
+ "author": "Parviz Khavari <csctclan@gmail.com>",
31
44
  "license": "Apache-2.0",
32
45
  "dependencies": {
33
- "qaseio": "^2.0.0-alpha.5"
46
+ "lodash.get": "^4.4.2",
47
+ "lodash.has": "^4.5.2",
48
+ "qase-javascript-commons": "^2.0.0-beta.0",
49
+ "uuid": "^9.0.0"
34
50
  },
35
51
  "devDependencies": {
36
- "@hutson/npm-deploy-git-tag": "^6.0.0",
37
- "@jest/reporters": "^27.0.4",
38
- "@types/chalk": "^2.2.0",
39
- "@types/deasync": "^0.1.1",
40
- "@types/jest": "^23.3.7",
41
- "@typescript-eslint/eslint-plugin": "^3.10.1",
42
- "@typescript-eslint/eslint-plugin-tslint": "^3.10.1",
43
- "@typescript-eslint/parser": "^3.10.1",
44
- "axios-mock-adapter": "^1.19.0",
45
- "chalk": "^4.1.0",
46
- "eslint": "^7.14.0",
47
- "eslint-plugin-jsdoc": "^26.0.1",
48
- "eslint-plugin-prefer-arrow": "^1.2.2",
49
- "handlebars": "^4.7.7",
50
- "jest": "^26.6.3",
51
- "nodemon": "^2.0.6",
52
- "ts-jest": "^26.4.4",
53
- "typescript": "^3.9.7"
52
+ "@jest/globals": "^29.5.0",
53
+ "@jest/reporters": "^29.5.0",
54
+ "@jest/test-result": "^29.5.0",
55
+ "@types/jest": "^29.5.2",
56
+ "@types/lodash.get": "^4.4.7",
57
+ "@types/lodash.has": "^4.5.7",
58
+ "jest": "^29.5.0",
59
+ "ts-jest": "^29.1.0"
60
+ },
61
+ "peerDependencies": {
62
+ "jest": ">=28.0.0"
54
63
  }
55
64
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "noEmit": false
6
+ },
7
+
8
+ "include": ["./src/**/*.ts"]
9
+ }
package/dist/index.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { Reporter, Test, TestResult } from '@jest/reporters';
2
- interface QaseOptions {
3
- apiToken: string;
4
- basePath?: string;
5
- rootSuiteTitle?: string;
6
- projectCode: string;
7
- runId?: string;
8
- runPrefix?: string;
9
- logging?: boolean;
10
- runComplete?: boolean;
11
- environmentId?: number;
12
- }
13
- declare class QaseReporter implements Reporter {
14
- private api;
15
- private options;
16
- private runId?;
17
- private isDisabled;
18
- private publishedResultsCount;
19
- private preparedTestCases;
20
- constructor(_: Record<string, unknown>, _options: QaseOptions);
21
- onRunStart(): Promise<void>;
22
- onTestResult(_test: Test, testResult: TestResult): Promise<void>;
23
- onRunComplete(): Promise<void>;
24
- getLastError(): void;
25
- private log;
26
- private getEnv;
27
- private getCaseIds;
28
- private logTestItem;
29
- private createPreparedForPublishTestsArray;
30
- private publishBulkTestResult;
31
- private checkProject;
32
- private createRunObject;
33
- private createRun;
34
- private checkRun;
35
- private createResultCasesArray;
36
- private createHeaders;
37
- private getPackageVersion;
38
- }
39
- export = QaseReporter;