qase-javascript-commons 2.0.0-beta.7 → 2.0.0-beta.9
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 +74 -97
- package/changelog.md +43 -0
- package/dist/config/config-validation-schema.js +8 -2
- package/dist/env/env-enum.d.ts +6 -1
- package/dist/env/env-enum.js +8 -2
- package/dist/env/env-to-config.js +3 -1
- package/dist/env/env-type.d.ts +2 -2
- package/dist/env/env-validation-schema.js +4 -4
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +3 -1
- package/dist/models/step-data.d.ts +6 -1
- package/dist/models/test-step.d.ts +7 -3
- package/dist/models/test-step.js +6 -0
- package/dist/qase.d.ts +2 -4
- package/dist/qase.js +21 -20
- package/dist/reporters/abstract-reporter.d.ts +6 -36
- package/dist/reporters/abstract-reporter.js +4 -84
- package/dist/reporters/report-reporter.d.ts +2 -3
- package/dist/reporters/report-reporter.js +4 -4
- package/dist/reporters/testops-reporter.d.ts +7 -5
- package/dist/reporters/testops-reporter.js +39 -14
- package/dist/utils/logger.d.ts +24 -0
- package/dist/utils/logger.js +121 -0
- package/dist/writer/fs-writer.d.ts +5 -0
- package/dist/writer/fs-writer.js +20 -0
- package/dist/writer/writer-interface.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,102 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
# Qase JavaScript Commons
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
$ npm install --save qase-core-reporter
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
> Create a new Qase JS reporter in minutes by leveraging this core reporter.
|
|
10
|
-
> Use Qase core reporter with test framework custom reporter hooks
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
import {
|
|
14
|
-
QaseCoreReporter,
|
|
15
|
-
QaseOptions,
|
|
16
|
-
QaseCoreReporterOptions,
|
|
17
|
-
TestResult
|
|
18
|
-
} from "qase-core-reporter";
|
|
3
|
+
This package contains common classes and functions for working with Qase TMS API.
|
|
19
4
|
|
|
20
|
-
|
|
21
|
-
// expected options, provided by reporter user
|
|
22
|
-
apiToken: 'lknkldnfknobek'
|
|
23
|
-
projectCode: 'DH'
|
|
24
|
-
};
|
|
5
|
+
## Installation
|
|
25
6
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
frameworkName: 'vitest',
|
|
29
|
-
reporterName: 'vitest-qase-reporter'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Initialize Core reporter with expected params
|
|
33
|
-
const reporter = new QaseCoreReporter(reporterOptions, qaseCoreReporterOptions);
|
|
34
|
-
|
|
35
|
-
// On start hook
|
|
36
|
-
reporter.start();
|
|
37
|
-
|
|
38
|
-
// On test results
|
|
39
|
-
reporter.addTestResult(test: TestResult, status, attachments);
|
|
40
|
-
|
|
41
|
-
// On end/complete hook
|
|
42
|
-
reporter.end({ spawn: false }); // spawn true will finish reporting in a child process
|
|
7
|
+
```bash
|
|
8
|
+
npm install qase-javascript-commons@beta
|
|
43
9
|
```
|
|
44
10
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Qase JS Reporters can be configured in multiple ways:
|
|
14
|
+
|
|
15
|
+
- using a config file `qase.config.json`
|
|
16
|
+
- using environment variables
|
|
17
|
+
|
|
18
|
+
All configuration options are listed in the table below:
|
|
19
|
+
|
|
20
|
+
| Description | Config file | Environment variable | Default value | Required | Possible values |
|
|
21
|
+
|----------------------------------------------------------------------------------------------------------------------------|----------------------------|---------------------------------|-----------------------------------------|----------|----------------------------|
|
|
22
|
+
| **Common** | | | | | |
|
|
23
|
+
| Mode of reporter | `mode` | `QASE_MODE` | `testops` | No | `testops`, `report`, `off` |
|
|
24
|
+
| Fallback mode of reporter | `fallback` | `QASE_FALLBACK` | `off` | No | `testops`, `report`, `off` |
|
|
25
|
+
| Environment | `environment` | `QASE_ENVIRONMENT` | `local` | No | Any string |
|
|
26
|
+
| Enable debug logs | `debug` | `QASE_DEBUG` | `False` | No | `True`, `False` |
|
|
27
|
+
| Enable capture logs from `stdout` and `stderr` | `testops.defect` | `QASE_CAPTURE_LOGS` | `False` | No | `True`, `False` |
|
|
28
|
+
| **Qase Report configuration** | | | | | |
|
|
29
|
+
| Driver used for report mode | `report.driver` | `QASE_REPORT_DRIVER` | `local` | No | `local` |
|
|
30
|
+
| Path to save the report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | | |
|
|
31
|
+
| Local report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `json` | | `json`, `jsonp` |
|
|
32
|
+
| **Qase TestOps configuration** | | | | | |
|
|
33
|
+
| Token for [API access](https://developers.qase.io/#authentication) | `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | | Yes | Any string |
|
|
34
|
+
| Qase API host | `testops.api.host` | `QASE_TESTOPS_API_HOST` | `qase.io` | No | Any string |
|
|
35
|
+
| Code of your project, which you can take from the URL: `https://app.qase.io/project/DEMOTR` - `DEMOTR` is the project code | `testops.project` | `QASE_TESTOPS_PROJECT` | | Yes | Any string |
|
|
36
|
+
| Qase test run ID | `testops.run.id` | `QASE_TESTOPS_RUN_ID` | | No | Any integer |
|
|
37
|
+
| Qase test run title | `testops.run.title` | `QASE_TESTOPS_RUN_TITLE` | `Automated run <Current date and time>` | No | Any string |
|
|
38
|
+
| Qase test run description | `testops.run.description` | `QASE_TESTOPS_RUN_DESCRIPTION` | `<Framework name> automated run` | No | Any string |
|
|
39
|
+
| Qase test run complete | `testops.run.complete` | `QASE_TESTOPS_RUN_COMPLETE` | `True` | | `True`, `False` |
|
|
40
|
+
| Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | | No | Any integer |
|
|
41
|
+
| Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
|
|
42
|
+
| Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
|
|
43
|
+
|
|
44
|
+
### Example `qase.config.json` config:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mode": "testops",
|
|
49
|
+
"fallback": "report",
|
|
50
|
+
"debug": false,
|
|
51
|
+
"environment": "local",
|
|
52
|
+
"captureLogs": false,
|
|
53
|
+
"report": {
|
|
54
|
+
"driver": "local",
|
|
55
|
+
"connection": {
|
|
56
|
+
"local": {
|
|
57
|
+
"path": "./build/qase-report",
|
|
58
|
+
"format": "json"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"testops": {
|
|
63
|
+
"api": {
|
|
64
|
+
"token": "<token>",
|
|
65
|
+
"host": "qase.io"
|
|
66
|
+
},
|
|
67
|
+
"run": {
|
|
68
|
+
"title": "Regress run",
|
|
69
|
+
"description": "Regress run description",
|
|
70
|
+
"complete": true
|
|
71
|
+
},
|
|
72
|
+
"defect": false,
|
|
73
|
+
"project": "<project_code>",
|
|
74
|
+
"batch": {
|
|
75
|
+
"size": 100
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
# qase-javascript-commons@2.0.0-beta.9
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Improved debug logging for better testing and reporting errors.
|
|
6
|
+
|
|
7
|
+
- Separate `logger` class for use in reporters, supporting logging to console and files.
|
|
8
|
+
- Extra debug logs in both reporter modes: TestOps and Local.
|
|
9
|
+
|
|
10
|
+
Fixed an issue with duplicate test runs created when the testing framework
|
|
11
|
+
(such as Cypress) uses more than one instance of the Qase reporter.
|
|
12
|
+
Now reporter handles Qase test runs in the following way:
|
|
13
|
+
|
|
14
|
+
1. The first instance of the reporter creates a Qase test run and stores the run ID
|
|
15
|
+
in the ENV variable `QASE_TESTOPS_RUN_ID`.
|
|
16
|
+
2. Other instances of the reporter read this variable and report test results
|
|
17
|
+
to the existing test run.
|
|
18
|
+
|
|
19
|
+
Nothing has changed in cases when there is a single instance of a reporter or
|
|
20
|
+
when it is using a test run, created with other tools, such as with an API request
|
|
21
|
+
or manually in the Qase app.
|
|
22
|
+
|
|
23
|
+
# qase-javascript-commons@2.0.0-beta.8
|
|
24
|
+
|
|
25
|
+
## What's new
|
|
26
|
+
|
|
27
|
+
Renamed the `QASE_TESTOPS_CHUNK` environment variable to `QASE_TESTOPS_BATCH_SIZE`.
|
|
28
|
+
Renamed the `chunk` field in the reporter's configuration to `batch.size`.
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
{
|
|
32
|
+
...
|
|
33
|
+
"testops": {
|
|
34
|
+
- "chunk": 10
|
|
35
|
+
+ "batch": {
|
|
36
|
+
+ "size": 10
|
|
37
|
+
+ }
|
|
38
|
+
...
|
|
39
|
+
},
|
|
40
|
+
...
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
1
44
|
# qase-javascript-commons@2.0.0-beta.7
|
|
2
45
|
|
|
3
46
|
## What's new
|
|
@@ -107,9 +107,15 @@ exports.configValidationSchema = {
|
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
|
-
|
|
111
|
-
type: '
|
|
110
|
+
batch: {
|
|
111
|
+
type: 'object',
|
|
112
112
|
nullable: true,
|
|
113
|
+
properties: {
|
|
114
|
+
size: {
|
|
115
|
+
type: 'number',
|
|
116
|
+
nullable: true,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
113
119
|
},
|
|
114
120
|
defect: {
|
|
115
121
|
type: 'boolean',
|
package/dist/env/env-enum.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare enum EnvEnum {
|
|
|
14
14
|
export declare enum EnvTestOpsEnum {
|
|
15
15
|
project = "QASE_TESTOPS_PROJECT",
|
|
16
16
|
uploadAttachments = "QASE_TESTOPS_UPLOAD_ATTACHMENTS",
|
|
17
|
-
chunk = "QASE_TESTOPS_CHUNK",
|
|
18
17
|
defect = "QASE_TESTOPS_DEFECT",
|
|
19
18
|
useV2 = "QASE_TESTOPS_API_V2"
|
|
20
19
|
}
|
|
@@ -40,6 +39,12 @@ export declare enum EnvRunEnum {
|
|
|
40
39
|
export declare enum EnvPlanEnum {
|
|
41
40
|
id = "QASE_TESTOPS_PLAN_ID"
|
|
42
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @enum {string}
|
|
44
|
+
*/
|
|
45
|
+
export declare enum EnvBatchEnum {
|
|
46
|
+
size = "QASE_TESTOPS_BATCH_SIZE"
|
|
47
|
+
}
|
|
43
48
|
/**
|
|
44
49
|
* @enum {string}
|
|
45
50
|
*/
|
package/dist/env/env-enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvLocalEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
3
|
+
exports.EnvLocalEnum = exports.EnvBatchEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @enum {string}
|
|
6
6
|
*/
|
|
@@ -19,7 +19,6 @@ var EnvTestOpsEnum;
|
|
|
19
19
|
(function (EnvTestOpsEnum) {
|
|
20
20
|
EnvTestOpsEnum["project"] = "QASE_TESTOPS_PROJECT";
|
|
21
21
|
EnvTestOpsEnum["uploadAttachments"] = "QASE_TESTOPS_UPLOAD_ATTACHMENTS";
|
|
22
|
-
EnvTestOpsEnum["chunk"] = "QASE_TESTOPS_CHUNK";
|
|
23
22
|
EnvTestOpsEnum["defect"] = "QASE_TESTOPS_DEFECT";
|
|
24
23
|
EnvTestOpsEnum["useV2"] = "QASE_TESTOPS_API_V2";
|
|
25
24
|
})(EnvTestOpsEnum || (exports.EnvTestOpsEnum = EnvTestOpsEnum = {}));
|
|
@@ -48,6 +47,13 @@ var EnvPlanEnum;
|
|
|
48
47
|
(function (EnvPlanEnum) {
|
|
49
48
|
EnvPlanEnum["id"] = "QASE_TESTOPS_PLAN_ID";
|
|
50
49
|
})(EnvPlanEnum || (exports.EnvPlanEnum = EnvPlanEnum = {}));
|
|
50
|
+
/**
|
|
51
|
+
* @enum {string}
|
|
52
|
+
*/
|
|
53
|
+
var EnvBatchEnum;
|
|
54
|
+
(function (EnvBatchEnum) {
|
|
55
|
+
EnvBatchEnum["size"] = "QASE_TESTOPS_BATCH_SIZE";
|
|
56
|
+
})(EnvBatchEnum || (exports.EnvBatchEnum = EnvBatchEnum = {}));
|
|
51
57
|
/**
|
|
52
58
|
* @enum {string}
|
|
53
59
|
*/
|
|
@@ -28,7 +28,9 @@ const envToConfig = (env) => ({
|
|
|
28
28
|
plan: {
|
|
29
29
|
id: env[env_enum_1.EnvPlanEnum.id],
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
batch: {
|
|
32
|
+
size: env[env_enum_1.EnvBatchEnum.size],
|
|
33
|
+
},
|
|
32
34
|
defect: env[env_enum_1.EnvTestOpsEnum.defect],
|
|
33
35
|
useV2: env[env_enum_1.EnvTestOpsEnum.useV2],
|
|
34
36
|
},
|
package/dist/env/env-type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum } from './env-enum';
|
|
1
|
+
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum, EnvBatchEnum } from './env-enum';
|
|
2
2
|
import { ModeEnum } from '../options';
|
|
3
3
|
import { FormatEnum } from '../writer';
|
|
4
4
|
export type EnvType = {
|
|
@@ -9,7 +9,6 @@ export type EnvType = {
|
|
|
9
9
|
[EnvEnum.captureLogs]?: boolean;
|
|
10
10
|
[EnvTestOpsEnum.project]?: string;
|
|
11
11
|
[EnvTestOpsEnum.uploadAttachments]?: boolean;
|
|
12
|
-
[EnvTestOpsEnum.chunk]?: number;
|
|
13
12
|
[EnvTestOpsEnum.defect]?: boolean;
|
|
14
13
|
[EnvTestOpsEnum.useV2]?: boolean;
|
|
15
14
|
[EnvApiEnum.token]?: string;
|
|
@@ -19,6 +18,7 @@ export type EnvType = {
|
|
|
19
18
|
[EnvRunEnum.description]?: string;
|
|
20
19
|
[EnvRunEnum.complete]?: boolean;
|
|
21
20
|
[EnvPlanEnum.id]?: number;
|
|
21
|
+
[EnvBatchEnum.size]?: number;
|
|
22
22
|
[EnvLocalEnum.path]?: string;
|
|
23
23
|
[EnvLocalEnum.format]?: `${FormatEnum}`;
|
|
24
24
|
};
|
|
@@ -40,10 +40,6 @@ exports.envValidationSchema = {
|
|
|
40
40
|
type: 'boolean',
|
|
41
41
|
nullable: true,
|
|
42
42
|
},
|
|
43
|
-
[env_enum_1.EnvTestOpsEnum.chunk]: {
|
|
44
|
-
type: 'number',
|
|
45
|
-
nullable: true,
|
|
46
|
-
},
|
|
47
43
|
[env_enum_1.EnvTestOpsEnum.defect]: {
|
|
48
44
|
type: 'boolean',
|
|
49
45
|
nullable: true,
|
|
@@ -80,6 +76,10 @@ exports.envValidationSchema = {
|
|
|
80
76
|
type: 'number',
|
|
81
77
|
nullable: true,
|
|
82
78
|
},
|
|
79
|
+
[env_enum_1.EnvBatchEnum.size]: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
nullable: true,
|
|
82
|
+
},
|
|
83
83
|
[env_enum_1.EnvLocalEnum.path]: {
|
|
84
84
|
type: 'string',
|
|
85
85
|
nullable: true,
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type TestResultType, Relation, Suite, SuiteData } from './test-result';
|
|
2
2
|
export { TestExecution, TestStatusEnum } from './test-execution';
|
|
3
|
-
export { type TestStepType } from './test-step';
|
|
3
|
+
export { type TestStepType, StepType } from './test-step';
|
|
4
4
|
export { StepStatusEnum } from './step-execution';
|
|
5
5
|
export { Attachment } from './attachment';
|
|
6
6
|
export { Report } from './report';
|
package/dist/models/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StepStatusEnum = exports.TestStatusEnum = void 0;
|
|
3
|
+
exports.StepStatusEnum = exports.StepType = exports.TestStatusEnum = void 0;
|
|
4
4
|
var test_execution_1 = require("./test-execution");
|
|
5
5
|
Object.defineProperty(exports, "TestStatusEnum", { enumerable: true, get: function () { return test_execution_1.TestStatusEnum; } });
|
|
6
|
+
var test_step_1 = require("./test-step");
|
|
7
|
+
Object.defineProperty(exports, "StepType", { enumerable: true, get: function () { return test_step_1.StepType; } });
|
|
6
8
|
var step_execution_1 = require("./step-execution");
|
|
7
9
|
Object.defineProperty(exports, "StepStatusEnum", { enumerable: true, get: function () { return step_execution_1.StepStatusEnum; } });
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StepGherkinData, StepTextData } from './step-data';
|
|
2
2
|
import { StepExecution } from './step-execution';
|
|
3
3
|
import { Attachment } from './attachment';
|
|
4
|
+
export declare enum StepType {
|
|
5
|
+
TEXT = "text",
|
|
6
|
+
GHERKIN = "gherkin"
|
|
7
|
+
}
|
|
4
8
|
export type TestStepType = {
|
|
5
9
|
id: string;
|
|
6
|
-
step_type:
|
|
7
|
-
data:
|
|
10
|
+
step_type: StepType;
|
|
11
|
+
data: StepTextData | StepGherkinData;
|
|
8
12
|
parent_id: string | null;
|
|
9
13
|
execution: StepExecution;
|
|
10
14
|
attachments: Attachment[];
|
package/dist/models/test-step.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepType = void 0;
|
|
4
|
+
var StepType;
|
|
5
|
+
(function (StepType) {
|
|
6
|
+
StepType["TEXT"] = "text";
|
|
7
|
+
StepType["GHERKIN"] = "gherkin";
|
|
8
|
+
})(StepType || (exports.StepType = StepType = {}));
|
package/dist/qase.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractReporter
|
|
1
|
+
import { AbstractReporter } from './reporters';
|
|
2
2
|
import { OptionsType } from './options';
|
|
3
3
|
import { TestResultType } from './models';
|
|
4
4
|
/**
|
|
@@ -36,9 +36,8 @@ export declare class QaseReporter extends AbstractReporter {
|
|
|
36
36
|
private useFallback;
|
|
37
37
|
/**
|
|
38
38
|
* @param {OptionsType} options
|
|
39
|
-
* @param {LoggerInterface} logger
|
|
40
39
|
*/
|
|
41
|
-
constructor(options: OptionsType
|
|
40
|
+
constructor(options: OptionsType);
|
|
42
41
|
/**
|
|
43
42
|
* @returns {Promise<void>}
|
|
44
43
|
*/
|
|
@@ -64,7 +63,6 @@ export declare class QaseReporter extends AbstractReporter {
|
|
|
64
63
|
* @todo implement mode registry
|
|
65
64
|
* @param {ModeEnum} mode
|
|
66
65
|
* @param {OptionsType} options
|
|
67
|
-
* @param {LoggerInterface} logger
|
|
68
66
|
* @returns {ReporterInterface}
|
|
69
67
|
* @private
|
|
70
68
|
*/
|
package/dist/qase.js
CHANGED
|
@@ -66,12 +66,11 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* @param {OptionsType} options
|
|
69
|
-
* @param {LoggerInterface} logger
|
|
70
69
|
*/
|
|
71
|
-
constructor(options
|
|
70
|
+
constructor(options) {
|
|
72
71
|
const env = (0, env_1.envToConfig)((0, env_schema_1.default)({ schema: env_1.envValidationSchema }));
|
|
73
72
|
const composedOptions = (0, options_1.composeOptions)(options, env);
|
|
74
|
-
super({ debug: composedOptions.debug, captureLogs: composedOptions.captureLogs }
|
|
73
|
+
super({ debug: composedOptions.debug, captureLogs: composedOptions.captureLogs });
|
|
75
74
|
/**
|
|
76
75
|
* @type {boolean}
|
|
77
76
|
* @private
|
|
@@ -82,17 +81,18 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
82
81
|
* @private
|
|
83
82
|
*/
|
|
84
83
|
this.useFallback = false;
|
|
84
|
+
this.logger.logDebug(`Config: ${JSON.stringify(composedOptions)}`);
|
|
85
85
|
try {
|
|
86
86
|
this.upstreamReporter = this.createReporter(
|
|
87
87
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
88
|
-
composedOptions.mode || options_1.ModeEnum.off, composedOptions
|
|
88
|
+
composedOptions.mode || options_1.ModeEnum.off, composedOptions);
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
91
|
if (error instanceof disabled_exception_1.DisabledException) {
|
|
92
92
|
this.disabled = true;
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
this.logError('Unable to create upstream reporter:', error);
|
|
95
|
+
this.logger.logError('Unable to create upstream reporter:', error);
|
|
96
96
|
if (composedOptions.fallback != undefined) {
|
|
97
97
|
this.disabled = true;
|
|
98
98
|
return;
|
|
@@ -103,7 +103,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
103
103
|
try {
|
|
104
104
|
this.fallbackReporter = this.createReporter(
|
|
105
105
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
106
|
-
composedOptions.fallback || options_1.ModeEnum.off, composedOptions
|
|
106
|
+
composedOptions.fallback || options_1.ModeEnum.off, composedOptions);
|
|
107
107
|
}
|
|
108
108
|
catch (error) {
|
|
109
109
|
if (error instanceof disabled_exception_1.DisabledException) {
|
|
@@ -112,7 +112,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
this.logError('Unable to create fallback reporter:', error);
|
|
115
|
+
this.logger.logError('Unable to create fallback reporter:', error);
|
|
116
116
|
if (this.useFallback && this.upstreamReporter === undefined) {
|
|
117
117
|
this.disabled = true;
|
|
118
118
|
}
|
|
@@ -124,11 +124,12 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
124
124
|
*/
|
|
125
125
|
async startTestRun() {
|
|
126
126
|
if (!this.disabled) {
|
|
127
|
+
this.logger.logDebug('Starting test run');
|
|
127
128
|
try {
|
|
128
129
|
await this.upstreamReporter?.startTestRun();
|
|
129
130
|
}
|
|
130
131
|
catch (error) {
|
|
131
|
-
this.logError('Unable to start test run in the upstream reporter: ', error);
|
|
132
|
+
this.logger.logError('Unable to start test run in the upstream reporter: ', error);
|
|
132
133
|
if (this.fallbackReporter == undefined) {
|
|
133
134
|
this.disabled = true;
|
|
134
135
|
return;
|
|
@@ -137,7 +138,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
137
138
|
await this.fallbackReporter?.startTestRun();
|
|
138
139
|
}
|
|
139
140
|
catch (error) {
|
|
140
|
-
this.logError('Unable to start test run in the fallback reporter: ', error);
|
|
141
|
+
this.logger.logError('Unable to start test run in the fallback reporter: ', error);
|
|
141
142
|
this.disabled = true;
|
|
142
143
|
}
|
|
143
144
|
}
|
|
@@ -157,7 +158,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
157
158
|
await this.upstreamReporter?.addTestResult(result);
|
|
158
159
|
}
|
|
159
160
|
catch (error) {
|
|
160
|
-
this.logError('Unable to add the result to the upstream reporter:', error);
|
|
161
|
+
this.logger.logError('Unable to add the result to the upstream reporter:', error);
|
|
161
162
|
if (this.fallbackReporter == undefined) {
|
|
162
163
|
this.disabled = true;
|
|
163
164
|
return;
|
|
@@ -179,7 +180,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
179
180
|
await this.fallbackReporter?.addTestResult(result);
|
|
180
181
|
}
|
|
181
182
|
catch (error) {
|
|
182
|
-
this.logError('Unable to add the result to the fallback reporter:', error);
|
|
183
|
+
this.logger.logError('Unable to add the result to the fallback reporter:', error);
|
|
183
184
|
this.disabled = true;
|
|
184
185
|
}
|
|
185
186
|
}
|
|
@@ -188,6 +189,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
188
189
|
*/
|
|
189
190
|
async publish() {
|
|
190
191
|
if (!this.disabled) {
|
|
192
|
+
this.logger.logDebug('Publishing test run results');
|
|
191
193
|
if (this.useFallback) {
|
|
192
194
|
await this.publishFallback();
|
|
193
195
|
}
|
|
@@ -195,7 +197,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
195
197
|
await this.upstreamReporter?.publish();
|
|
196
198
|
}
|
|
197
199
|
catch (error) {
|
|
198
|
-
this.logError('Unable to publish the run results to the upstream reporter:', error);
|
|
200
|
+
this.logger.logError('Unable to publish the run results to the upstream reporter:', error);
|
|
199
201
|
if (this.fallbackReporter == undefined) {
|
|
200
202
|
this.disabled = true;
|
|
201
203
|
return;
|
|
@@ -216,7 +218,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
216
218
|
await this.fallbackReporter?.publish();
|
|
217
219
|
}
|
|
218
220
|
catch (error) {
|
|
219
|
-
this.logError('Unable to publish the run results to the fallback reporter:', error);
|
|
221
|
+
this.logger.logError('Unable to publish the run results to the fallback reporter:', error);
|
|
220
222
|
this.disabled = true;
|
|
221
223
|
}
|
|
222
224
|
}
|
|
@@ -224,15 +226,14 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
224
226
|
* @todo implement mode registry
|
|
225
227
|
* @param {ModeEnum} mode
|
|
226
228
|
* @param {OptionsType} options
|
|
227
|
-
* @param {LoggerInterface} logger
|
|
228
229
|
* @returns {ReporterInterface}
|
|
229
230
|
* @private
|
|
230
231
|
*/
|
|
231
|
-
createReporter(mode, options
|
|
232
|
+
createReporter(mode, options) {
|
|
232
233
|
const { frameworkPackage, frameworkName, reporterName, environment, report = {}, testops = {}, ...commonOptions } = options;
|
|
233
234
|
switch (mode) {
|
|
234
235
|
case options_1.ModeEnum.testops: {
|
|
235
|
-
const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {},
|
|
236
|
+
const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {}, batch = {}, uploadAttachments, } = testops;
|
|
236
237
|
if (!token) {
|
|
237
238
|
throw new Error(`Either "testops.api.token" parameter or "${env_1.EnvApiEnum.token}" environment variable is required in "testops" mode`);
|
|
238
239
|
}
|
|
@@ -256,10 +257,10 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
256
257
|
...run,
|
|
257
258
|
},
|
|
258
259
|
plan,
|
|
259
|
-
|
|
260
|
+
batch,
|
|
260
261
|
debug: commonOptions.debug,
|
|
261
262
|
captureLogs: commonOptions.captureLogs,
|
|
262
|
-
}, apiClient,
|
|
263
|
+
}, apiClient, typeof environment === 'number' ? environment : undefined);
|
|
263
264
|
}
|
|
264
265
|
case options_1.ModeEnum.report: {
|
|
265
266
|
const localOptions = report.connections?.[writer_1.DriverEnum.local];
|
|
@@ -267,7 +268,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
267
268
|
return new reporters_1.ReportReporter({
|
|
268
269
|
debug: commonOptions.debug,
|
|
269
270
|
captureLogs: commonOptions.captureLogs,
|
|
270
|
-
}, writer,
|
|
271
|
+
}, writer, typeof environment === 'number' ? environment.toString() : environment, testops.run?.id);
|
|
271
272
|
}
|
|
272
273
|
case options_1.ModeEnum.off:
|
|
273
274
|
throw new disabled_exception_1.DisabledException();
|
|
@@ -280,7 +281,7 @@ class QaseReporter extends reporters_1.AbstractReporter {
|
|
|
280
281
|
* @private
|
|
281
282
|
*/
|
|
282
283
|
logTestItem(test) {
|
|
283
|
-
this.log(resultLogMap[test.execution.status](test));
|
|
284
|
+
this.logger.log(resultLogMap[test.execution.status](test));
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
exports.QaseReporter = QaseReporter;
|