qase-javascript-commons 2.0.0-beta.0 → 2.0.0-beta.2
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/changelog.md +23 -0
- package/dist/config/config-loader-interface.d.ts +4 -0
- package/dist/config/config-loader-interface.js +2 -0
- package/dist/config/config-loader.d.ts +10 -0
- package/dist/config/config-loader.js +58 -0
- package/dist/config/config-type.d.ts +2 -0
- package/dist/config/config-type.js +2 -0
- package/dist/config/config-validation-schema.d.ts +6 -0
- package/dist/config/config-validation-schema.js +149 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.js +7 -0
- package/dist/env/env-enum.d.ts +47 -0
- package/dist/env/env-enum.js +56 -0
- package/dist/env/env-to-config.d.ts +7 -0
- package/dist/env/env-to-config.js +42 -0
- package/dist/env/env-type.d.ts +22 -0
- package/dist/env/env-type.js +3 -0
- package/dist/env/env-validation-schema.d.ts +6 -0
- package/dist/env/env-validation-schema.js +85 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +13 -0
- package/dist/formatter/formatter-interface.d.ts +3 -0
- package/dist/formatter/formatter-interface.js +2 -0
- package/dist/formatter/index.d.ts +3 -0
- package/dist/formatter/index.js +7 -0
- package/dist/formatter/json-formatter.d.ts +13 -0
- package/dist/formatter/json-formatter.js +27 -0
- package/dist/formatter/jsonp-formatter.d.ts +13 -0
- package/dist/formatter/jsonp-formatter.js +28 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +25 -0
- package/dist/models/attachment.d.ts +8 -0
- package/dist/models/attachment.js +2 -0
- package/dist/models/execution-sum.d.ts +6 -0
- package/dist/models/execution-sum.js +2 -0
- package/dist/models/host-data.d.ts +11 -0
- package/dist/models/host-data.js +2 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +7 -0
- package/dist/models/report.d.ts +14 -0
- package/dist/models/report.js +2 -0
- package/dist/models/short-result.d.ts +7 -0
- package/dist/models/short-result.js +2 -0
- package/dist/models/stats.d.ts +8 -0
- package/dist/models/stats.js +2 -0
- package/dist/models/step-data.d.ts +4 -0
- package/dist/models/step-data.js +2 -0
- package/dist/models/step-execution.d.ts +11 -0
- package/dist/models/step-execution.js +9 -0
- package/dist/models/test-execution.d.ts +19 -0
- package/dist/models/test-execution.js +15 -0
- package/dist/models/test-result.d.ts +19 -0
- package/dist/models/test-result.js +2 -0
- package/dist/models/test-step.d.ts +12 -0
- package/dist/models/test-step.js +2 -0
- package/dist/options/composeOptions.d.ts +9 -0
- package/dist/options/composeOptions.js +12 -0
- package/dist/options/index.d.ts +3 -0
- package/dist/options/index.js +7 -0
- package/dist/options/mode-enum.d.ts +8 -0
- package/dist/options/mode-enum.js +12 -0
- package/dist/options/options-type.d.ts +32 -0
- package/dist/options/options-type.js +3 -0
- package/dist/qase.d.ts +73 -0
- package/dist/qase.js +258 -0
- package/dist/reporters/abstract-reporter.d.ts +79 -0
- package/dist/reporters/abstract-reporter.js +136 -0
- package/dist/reporters/index.d.ts +3 -0
- package/dist/reporters/index.js +9 -0
- package/dist/reporters/report-reporter.d.ts +43 -0
- package/dist/reporters/report-reporter.js +179 -0
- package/dist/reporters/testops-reporter.d.ts +113 -0
- package/dist/reporters/testops-reporter.js +232 -0
- package/dist/utils/custom-boundary.d.ts +26 -0
- package/dist/utils/custom-boundary.js +30 -0
- package/dist/utils/disabled-exception.d.ts +6 -0
- package/dist/utils/disabled-exception.js +10 -0
- package/dist/utils/get-package-version.d.ts +5 -0
- package/dist/utils/get-package-version.js +25 -0
- package/dist/utils/is-axios-error.d.ts +6 -0
- package/dist/utils/is-axios-error.js +11 -0
- package/dist/utils/qase-error.d.ts +18 -0
- package/dist/utils/qase-error.js +15 -0
- package/dist/utils/validate-json.d.ts +20 -0
- package/dist/utils/validate-json.js +40 -0
- package/dist/writer/driver-enum.d.ts +13 -0
- package/dist/writer/driver-enum.js +18 -0
- package/dist/writer/fs-writer.d.ts +35 -0
- package/dist/writer/fs-writer.js +106 -0
- package/dist/writer/index.d.ts +3 -0
- package/dist/writer/index.js +8 -0
- package/dist/writer/writer-interface.d.ts +6 -0
- package/dist/writer/writer-interface.js +2 -0
- package/package.json +4 -3
package/changelog.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# qase-javascript-commons@2.0.0-beta.2
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Package `qase-javascript-commons` contains common functions, used by all Qase JavaScript reporters.
|
|
6
|
+
|
|
7
|
+
This is a beta channel release.
|
|
8
|
+
Don't install this package explicitly.
|
|
9
|
+
Instead, install the test reporter for your framework, for example:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install playwright-qase-reporter@beta
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What's new
|
|
16
|
+
|
|
17
|
+
* Set a fallback reporter when the primary reporter can't be used,
|
|
18
|
+
such as when the `testops` reporter can't authenticate with the Qase API.
|
|
19
|
+
* Rename some environment variables to keep naming consistent between reporters in all languages.
|
|
20
|
+
* Add several environment variables for new config options.
|
|
21
|
+
* Write outputs in JSONP format, which can be used with
|
|
22
|
+
[Qase Report](https://github.com/qase-tms/qase-report).
|
|
23
|
+
* Logic for handling test with multiple case IDs moved to the commons package.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { ConfigLoaderInterface } from './config-loader-interface';
|
|
3
|
+
import { ConfigType } from './config-type';
|
|
4
|
+
export declare class ConfigLoader<T extends Partial<ConfigType> & Record<string, unknown>> implements ConfigLoaderInterface<T> {
|
|
5
|
+
private paths;
|
|
6
|
+
private validationSchema;
|
|
7
|
+
constructor(validationSchema?: JSONSchemaType<T>, paths?: string[]);
|
|
8
|
+
private read;
|
|
9
|
+
load(): (T & ConfigType) | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConfigLoader = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
10
|
+
const qase_error_1 = require("../utils/qase-error");
|
|
11
|
+
const validate_json_1 = require("../utils/validate-json");
|
|
12
|
+
const config_validation_schema_1 = require("./config-validation-schema");
|
|
13
|
+
class ConfigLoader {
|
|
14
|
+
constructor(validationSchema, paths = ['qase.config.json', '.qaserc']) {
|
|
15
|
+
this.paths = paths;
|
|
16
|
+
this.validationSchema = (0, lodash_merge_1.default)({}, config_validation_schema_1.configValidationSchema, validationSchema);
|
|
17
|
+
}
|
|
18
|
+
read() {
|
|
19
|
+
for (const path of this.paths) {
|
|
20
|
+
const filePath = (0, path_1.join)(process.cwd(), path);
|
|
21
|
+
try {
|
|
22
|
+
return (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
const isNotFound = error instanceof Error &&
|
|
26
|
+
'code' in error &&
|
|
27
|
+
(error.code === 'ENOENT' || error.code === 'EISDIR');
|
|
28
|
+
if (!isNotFound) {
|
|
29
|
+
throw new qase_error_1.QaseError('Cannot read config file', { cause: error });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
load() {
|
|
36
|
+
try {
|
|
37
|
+
const data = this.read();
|
|
38
|
+
if (data) {
|
|
39
|
+
const json = JSON.parse(data);
|
|
40
|
+
(0, validate_json_1.validateJson)(this.validationSchema, json);
|
|
41
|
+
return json;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof validate_json_1.JsonValidationError) {
|
|
46
|
+
const [validationError] = error.validationErrors;
|
|
47
|
+
const { instancePath = '', message = '' } = validationError ?? {};
|
|
48
|
+
const configPath = instancePath
|
|
49
|
+
? `\`${instancePath.substring(1).replace('/', '.')}\``
|
|
50
|
+
: 'it';
|
|
51
|
+
throw new Error(`Invalid config: "${configPath}" ${message}`);
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ConfigLoader = ConfigLoader;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configValidationSchema = void 0;
|
|
4
|
+
const options_1 = require("../options");
|
|
5
|
+
const writer_1 = require("../writer");
|
|
6
|
+
/**
|
|
7
|
+
* @type {JSONSchemaType<ConfigType>}
|
|
8
|
+
*/
|
|
9
|
+
exports.configValidationSchema = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
mode: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
|
|
15
|
+
nullable: true,
|
|
16
|
+
},
|
|
17
|
+
fallback: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
|
|
20
|
+
nullable: true,
|
|
21
|
+
},
|
|
22
|
+
debug: {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
nullable: true,
|
|
25
|
+
},
|
|
26
|
+
environment: {
|
|
27
|
+
type: ['string', 'number'],
|
|
28
|
+
nullable: true,
|
|
29
|
+
},
|
|
30
|
+
testops: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
nullable: true,
|
|
33
|
+
properties: {
|
|
34
|
+
api: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
nullable: true,
|
|
37
|
+
properties: {
|
|
38
|
+
token: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
nullable: true,
|
|
41
|
+
},
|
|
42
|
+
baseUrl: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
nullable: true,
|
|
45
|
+
},
|
|
46
|
+
headers: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
nullable: true,
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
patternProperties: {
|
|
51
|
+
'^.*$': {
|
|
52
|
+
type: 'string',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
retries: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
nullable: true,
|
|
59
|
+
},
|
|
60
|
+
retryDelay: {
|
|
61
|
+
type: 'number',
|
|
62
|
+
nullable: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
project: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
nullable: true,
|
|
69
|
+
},
|
|
70
|
+
uploadAttachments: {
|
|
71
|
+
type: 'boolean',
|
|
72
|
+
nullable: true,
|
|
73
|
+
},
|
|
74
|
+
run: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
nullable: true,
|
|
77
|
+
properties: {
|
|
78
|
+
id: {
|
|
79
|
+
type: 'number',
|
|
80
|
+
nullable: true,
|
|
81
|
+
},
|
|
82
|
+
title: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
nullable: true,
|
|
85
|
+
},
|
|
86
|
+
description: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
nullable: true,
|
|
89
|
+
},
|
|
90
|
+
complete: {
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
nullable: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
plan: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
nullable: true,
|
|
99
|
+
properties: {
|
|
100
|
+
id: {
|
|
101
|
+
type: 'number',
|
|
102
|
+
nullable: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
chunk: {
|
|
107
|
+
type: 'number',
|
|
108
|
+
nullable: true,
|
|
109
|
+
},
|
|
110
|
+
defect: {
|
|
111
|
+
type: 'boolean',
|
|
112
|
+
nullable: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
report: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
nullable: true,
|
|
119
|
+
properties: {
|
|
120
|
+
driver: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
enum: [writer_1.DriverEnum.local],
|
|
123
|
+
nullable: true,
|
|
124
|
+
},
|
|
125
|
+
connections: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
nullable: true,
|
|
128
|
+
properties: {
|
|
129
|
+
[writer_1.DriverEnum.local]: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
nullable: true,
|
|
132
|
+
properties: {
|
|
133
|
+
path: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
nullable: true,
|
|
136
|
+
},
|
|
137
|
+
format: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
enum: [writer_1.FormatEnum.json, writer_1.FormatEnum.jsonp],
|
|
140
|
+
nullable: true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoader = exports.configValidationSchema = void 0;
|
|
4
|
+
var config_validation_schema_1 = require("./config-validation-schema");
|
|
5
|
+
Object.defineProperty(exports, "configValidationSchema", { enumerable: true, get: function () { return config_validation_schema_1.configValidationSchema; } });
|
|
6
|
+
var config_loader_1 = require("./config-loader");
|
|
7
|
+
Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return config_loader_1.ConfigLoader; } });
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enum {string}
|
|
3
|
+
*/
|
|
4
|
+
export declare enum EnvEnum {
|
|
5
|
+
mode = "QASE_MODE",
|
|
6
|
+
fallback = "QASE_FALLBACK",
|
|
7
|
+
debug = "QASE_DEBUG",
|
|
8
|
+
environment = "QASE_ENVIRONMENT"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @enum {string}
|
|
12
|
+
*/
|
|
13
|
+
export declare enum EnvTestOpsEnum {
|
|
14
|
+
project = "QASE_TESTOPS_PROJECT",
|
|
15
|
+
uploadAttachments = "QASE_TESTOPS_UPLOAD_ATTACHMENTS",
|
|
16
|
+
chunk = "QASE_TESTOPS_CHUNK",
|
|
17
|
+
defect = "QASE_TESTOPS_DEFECT"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @enum {string}
|
|
21
|
+
*/
|
|
22
|
+
export declare enum EnvApiEnum {
|
|
23
|
+
token = "QASE_TESTOPS_API_TOKEN",
|
|
24
|
+
baseUrl = "QASE_TESTOPS_API_HOST"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @enum {string}
|
|
28
|
+
*/
|
|
29
|
+
export declare enum EnvRunEnum {
|
|
30
|
+
id = "QASE_TESTOPS_RUN_ID",
|
|
31
|
+
title = "QASE_TESTOPS_RUN_TITLE",
|
|
32
|
+
description = "QASE_TESTOPS_RUN_DESCRIPTION",
|
|
33
|
+
complete = "QASE_TESTOPS_RUN_COMPLETE"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @enum {string}
|
|
37
|
+
*/
|
|
38
|
+
export declare enum EnvPlanEnum {
|
|
39
|
+
id = "QASE_TESTOPS_PLAN_ID"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @enum {string}
|
|
43
|
+
*/
|
|
44
|
+
export declare enum EnvLocalEnum {
|
|
45
|
+
path = "QASE_REPORT_CONNECTION_PATH",
|
|
46
|
+
format = "QASE_REPORT_CONNECTION_FORMAT"
|
|
47
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvLocalEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
var EnvEnum;
|
|
8
|
+
(function (EnvEnum) {
|
|
9
|
+
EnvEnum["mode"] = "QASE_MODE";
|
|
10
|
+
EnvEnum["fallback"] = "QASE_FALLBACK";
|
|
11
|
+
EnvEnum["debug"] = "QASE_DEBUG";
|
|
12
|
+
EnvEnum["environment"] = "QASE_ENVIRONMENT";
|
|
13
|
+
})(EnvEnum || (exports.EnvEnum = EnvEnum = {}));
|
|
14
|
+
/**
|
|
15
|
+
* @enum {string}
|
|
16
|
+
*/
|
|
17
|
+
var EnvTestOpsEnum;
|
|
18
|
+
(function (EnvTestOpsEnum) {
|
|
19
|
+
EnvTestOpsEnum["project"] = "QASE_TESTOPS_PROJECT";
|
|
20
|
+
EnvTestOpsEnum["uploadAttachments"] = "QASE_TESTOPS_UPLOAD_ATTACHMENTS";
|
|
21
|
+
EnvTestOpsEnum["chunk"] = "QASE_TESTOPS_CHUNK";
|
|
22
|
+
EnvTestOpsEnum["defect"] = "QASE_TESTOPS_DEFECT";
|
|
23
|
+
})(EnvTestOpsEnum || (exports.EnvTestOpsEnum = EnvTestOpsEnum = {}));
|
|
24
|
+
/**
|
|
25
|
+
* @enum {string}
|
|
26
|
+
*/
|
|
27
|
+
var EnvApiEnum;
|
|
28
|
+
(function (EnvApiEnum) {
|
|
29
|
+
EnvApiEnum["token"] = "QASE_TESTOPS_API_TOKEN";
|
|
30
|
+
EnvApiEnum["baseUrl"] = "QASE_TESTOPS_API_HOST";
|
|
31
|
+
})(EnvApiEnum || (exports.EnvApiEnum = EnvApiEnum = {}));
|
|
32
|
+
/**
|
|
33
|
+
* @enum {string}
|
|
34
|
+
*/
|
|
35
|
+
var EnvRunEnum;
|
|
36
|
+
(function (EnvRunEnum) {
|
|
37
|
+
EnvRunEnum["id"] = "QASE_TESTOPS_RUN_ID";
|
|
38
|
+
EnvRunEnum["title"] = "QASE_TESTOPS_RUN_TITLE";
|
|
39
|
+
EnvRunEnum["description"] = "QASE_TESTOPS_RUN_DESCRIPTION";
|
|
40
|
+
EnvRunEnum["complete"] = "QASE_TESTOPS_RUN_COMPLETE";
|
|
41
|
+
})(EnvRunEnum || (exports.EnvRunEnum = EnvRunEnum = {}));
|
|
42
|
+
/**
|
|
43
|
+
* @enum {string}
|
|
44
|
+
*/
|
|
45
|
+
var EnvPlanEnum;
|
|
46
|
+
(function (EnvPlanEnum) {
|
|
47
|
+
EnvPlanEnum["id"] = "QASE_TESTOPS_PLAN_ID";
|
|
48
|
+
})(EnvPlanEnum || (exports.EnvPlanEnum = EnvPlanEnum = {}));
|
|
49
|
+
/**
|
|
50
|
+
* @enum {string}
|
|
51
|
+
*/
|
|
52
|
+
var EnvLocalEnum;
|
|
53
|
+
(function (EnvLocalEnum) {
|
|
54
|
+
EnvLocalEnum["path"] = "QASE_REPORT_CONNECTION_PATH";
|
|
55
|
+
EnvLocalEnum["format"] = "QASE_REPORT_CONNECTION_FORMAT";
|
|
56
|
+
})(EnvLocalEnum || (exports.EnvLocalEnum = EnvLocalEnum = {}));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.envToConfig = void 0;
|
|
4
|
+
const env_enum_1 = require("./env-enum");
|
|
5
|
+
const writer_1 = require("../writer");
|
|
6
|
+
/**
|
|
7
|
+
* @param {EnvType} env
|
|
8
|
+
* @returns {ConfigType}
|
|
9
|
+
*/
|
|
10
|
+
const envToConfig = (env) => ({
|
|
11
|
+
mode: env[env_enum_1.EnvEnum.mode],
|
|
12
|
+
debug: env[env_enum_1.EnvEnum.debug],
|
|
13
|
+
environment: env[env_enum_1.EnvEnum.environment],
|
|
14
|
+
testops: {
|
|
15
|
+
project: env[env_enum_1.EnvTestOpsEnum.project],
|
|
16
|
+
uploadAttachments: env[env_enum_1.EnvTestOpsEnum.uploadAttachments],
|
|
17
|
+
api: {
|
|
18
|
+
token: env[env_enum_1.EnvApiEnum.token],
|
|
19
|
+
baseUrl: env[env_enum_1.EnvApiEnum.baseUrl],
|
|
20
|
+
},
|
|
21
|
+
run: {
|
|
22
|
+
id: env[env_enum_1.EnvRunEnum.id],
|
|
23
|
+
title: env[env_enum_1.EnvRunEnum.title],
|
|
24
|
+
description: env[env_enum_1.EnvRunEnum.description],
|
|
25
|
+
complete: env[env_enum_1.EnvRunEnum.complete],
|
|
26
|
+
},
|
|
27
|
+
plan: {
|
|
28
|
+
id: env[env_enum_1.EnvPlanEnum.id],
|
|
29
|
+
},
|
|
30
|
+
chunk: env[env_enum_1.EnvTestOpsEnum.chunk],
|
|
31
|
+
defect: env[env_enum_1.EnvTestOpsEnum.defect],
|
|
32
|
+
},
|
|
33
|
+
report: {
|
|
34
|
+
connections: {
|
|
35
|
+
[writer_1.DriverEnum.local]: {
|
|
36
|
+
path: env[env_enum_1.EnvLocalEnum.path],
|
|
37
|
+
format: env[env_enum_1.EnvLocalEnum.format],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
exports.envToConfig = envToConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum } from './env-enum';
|
|
2
|
+
import { ModeEnum } from '../options';
|
|
3
|
+
import { FormatEnum } from '../writer';
|
|
4
|
+
export type EnvType = {
|
|
5
|
+
[EnvEnum.mode]?: `${ModeEnum}`;
|
|
6
|
+
[EnvEnum.fallback]?: `${ModeEnum}`;
|
|
7
|
+
[EnvEnum.debug]?: boolean;
|
|
8
|
+
[EnvEnum.environment]?: string | number;
|
|
9
|
+
[EnvTestOpsEnum.project]?: string;
|
|
10
|
+
[EnvTestOpsEnum.uploadAttachments]?: boolean;
|
|
11
|
+
[EnvTestOpsEnum.chunk]?: number;
|
|
12
|
+
[EnvTestOpsEnum.defect]?: boolean;
|
|
13
|
+
[EnvApiEnum.token]?: string;
|
|
14
|
+
[EnvApiEnum.baseUrl]?: string;
|
|
15
|
+
[EnvRunEnum.id]?: number;
|
|
16
|
+
[EnvRunEnum.title]?: string;
|
|
17
|
+
[EnvRunEnum.description]?: string;
|
|
18
|
+
[EnvRunEnum.complete]?: boolean;
|
|
19
|
+
[EnvPlanEnum.id]?: number;
|
|
20
|
+
[EnvLocalEnum.path]?: string;
|
|
21
|
+
[EnvLocalEnum.format]?: `${FormatEnum}`;
|
|
22
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.envValidationSchema = void 0;
|
|
4
|
+
const env_enum_1 = require("./env-enum");
|
|
5
|
+
const options_1 = require("../options");
|
|
6
|
+
const writer_1 = require("../writer");
|
|
7
|
+
/**
|
|
8
|
+
* @type {JSONSchemaType<EnvType>}
|
|
9
|
+
*/
|
|
10
|
+
exports.envValidationSchema = {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
[env_enum_1.EnvEnum.mode]: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
|
|
16
|
+
nullable: true,
|
|
17
|
+
},
|
|
18
|
+
[env_enum_1.EnvEnum.fallback]: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.testops, options_1.ModeEnum.off],
|
|
21
|
+
nullable: true,
|
|
22
|
+
},
|
|
23
|
+
[env_enum_1.EnvEnum.debug]: {
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
nullable: true,
|
|
26
|
+
},
|
|
27
|
+
[env_enum_1.EnvEnum.environment]: {
|
|
28
|
+
type: ['string', 'number'],
|
|
29
|
+
nullable: true,
|
|
30
|
+
},
|
|
31
|
+
[env_enum_1.EnvTestOpsEnum.project]: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
nullable: true,
|
|
34
|
+
},
|
|
35
|
+
[env_enum_1.EnvTestOpsEnum.uploadAttachments]: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
nullable: true,
|
|
38
|
+
},
|
|
39
|
+
[env_enum_1.EnvTestOpsEnum.chunk]: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
nullable: true,
|
|
42
|
+
},
|
|
43
|
+
[env_enum_1.EnvTestOpsEnum.defect]: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
nullable: true,
|
|
46
|
+
},
|
|
47
|
+
[env_enum_1.EnvApiEnum.token]: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
nullable: true,
|
|
50
|
+
},
|
|
51
|
+
[env_enum_1.EnvApiEnum.baseUrl]: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
nullable: true,
|
|
54
|
+
},
|
|
55
|
+
[env_enum_1.EnvRunEnum.id]: {
|
|
56
|
+
type: 'number',
|
|
57
|
+
nullable: true,
|
|
58
|
+
},
|
|
59
|
+
[env_enum_1.EnvRunEnum.title]: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
nullable: true,
|
|
62
|
+
},
|
|
63
|
+
[env_enum_1.EnvRunEnum.description]: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
nullable: true,
|
|
66
|
+
},
|
|
67
|
+
[env_enum_1.EnvRunEnum.complete]: {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
nullable: true,
|
|
70
|
+
},
|
|
71
|
+
[env_enum_1.EnvPlanEnum.id]: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
nullable: true,
|
|
74
|
+
},
|
|
75
|
+
[env_enum_1.EnvLocalEnum.path]: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
nullable: true,
|
|
78
|
+
},
|
|
79
|
+
[env_enum_1.EnvLocalEnum.format]: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
enum: [writer_1.FormatEnum.json, writer_1.FormatEnum.jsonp],
|
|
82
|
+
nullable: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.envToConfig = exports.envValidationSchema = exports.EnvLocalEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
4
|
+
var env_enum_1 = require("./env-enum");
|
|
5
|
+
Object.defineProperty(exports, "EnvEnum", { enumerable: true, get: function () { return env_enum_1.EnvEnum; } });
|
|
6
|
+
Object.defineProperty(exports, "EnvTestOpsEnum", { enumerable: true, get: function () { return env_enum_1.EnvTestOpsEnum; } });
|
|
7
|
+
Object.defineProperty(exports, "EnvApiEnum", { enumerable: true, get: function () { return env_enum_1.EnvApiEnum; } });
|
|
8
|
+
Object.defineProperty(exports, "EnvRunEnum", { enumerable: true, get: function () { return env_enum_1.EnvRunEnum; } });
|
|
9
|
+
Object.defineProperty(exports, "EnvLocalEnum", { enumerable: true, get: function () { return env_enum_1.EnvLocalEnum; } });
|
|
10
|
+
var env_validation_schema_1 = require("./env-validation-schema");
|
|
11
|
+
Object.defineProperty(exports, "envValidationSchema", { enumerable: true, get: function () { return env_validation_schema_1.envValidationSchema; } });
|
|
12
|
+
var env_to_config_1 = require("./env-to-config");
|
|
13
|
+
Object.defineProperty(exports, "envToConfig", { enumerable: true, get: function () { return env_to_config_1.envToConfig; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonpFormatter = exports.JsonFormatter = void 0;
|
|
4
|
+
var json_formatter_1 = require("./json-formatter");
|
|
5
|
+
Object.defineProperty(exports, "JsonFormatter", { enumerable: true, get: function () { return json_formatter_1.JsonFormatter; } });
|
|
6
|
+
var jsonp_formatter_1 = require("./jsonp-formatter");
|
|
7
|
+
Object.defineProperty(exports, "JsonpFormatter", { enumerable: true, get: function () { return jsonp_formatter_1.JsonpFormatter; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormatterInterface } from './formatter-interface';
|
|
2
|
+
export type JsonFormatterOptionsType = {
|
|
3
|
+
space?: number | undefined;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @class JsonFormatter
|
|
7
|
+
* @implements FormatterInterface
|
|
8
|
+
*/
|
|
9
|
+
export declare class JsonFormatter implements FormatterInterface {
|
|
10
|
+
private space;
|
|
11
|
+
constructor(options?: JsonFormatterOptionsType);
|
|
12
|
+
format(object: unknown): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.JsonFormatter = void 0;
|
|
7
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
8
|
+
/**
|
|
9
|
+
* @class JsonFormatter
|
|
10
|
+
* @implements FormatterInterface
|
|
11
|
+
*/
|
|
12
|
+
class JsonFormatter {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
const { space = 4 } = options;
|
|
15
|
+
this.space = space;
|
|
16
|
+
}
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
18
|
+
async format(object) {
|
|
19
|
+
return JSON.stringify(object, (key, value) => {
|
|
20
|
+
if (key === 'error' && value instanceof Error) {
|
|
21
|
+
return (0, strip_ansi_1.default)(String(value));
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}, this.space);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.JsonFormatter = JsonFormatter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormatterInterface } from './formatter-interface';
|
|
2
|
+
export type JsonpFormatterOptionsType = {
|
|
3
|
+
space?: number | undefined;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @class JsonFormatter
|
|
7
|
+
* @implements FormatterInterface
|
|
8
|
+
*/
|
|
9
|
+
export declare class JsonpFormatter implements FormatterInterface {
|
|
10
|
+
private space;
|
|
11
|
+
constructor(options?: JsonpFormatterOptionsType);
|
|
12
|
+
format(object: unknown): Promise<string>;
|
|
13
|
+
}
|