qase-javascript-commons 2.4.4 → 2.4.6
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 +24 -4
- package/changelog.md +13 -0
- package/dist/client/dateUtils.js +2 -3
- package/dist/config/config-validation-schema.d.ts +21 -0
- package/dist/config/config-validation-schema.js +21 -0
- package/dist/env/env-enum.d.ts +9 -1
- package/dist/env/env-enum.js +10 -1
- package/dist/env/env-to-config.js +9 -0
- package/dist/env/env-type.d.ts +4 -1
- package/dist/env/env-validation-schema.js +12 -0
- package/dist/models/attachment.d.ts +0 -1
- package/dist/options/composeOptions.d.ts +0 -1
- package/dist/options/options-type.d.ts +6 -0
- package/dist/qase.d.ts +5 -0
- package/dist/qase.js +29 -1
- package/dist/utils/hostData.js +18 -9
- package/dist/utils/is-axios-error.d.ts +1 -1
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.js +38 -14
- package/dist/utils/mimeTypes.js +18 -9
- package/dist/utils/status-mapping-utils.d.ts +14 -0
- package/dist/utils/status-mapping-utils.js +45 -0
- package/dist/utils/test-status-utils.js +1 -2
- package/dist/utils/validate-json.js +2 -2
- package/dist/writer/fs-writer.js +17 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,8 +26,9 @@ npm install qase-javascript-commons
|
|
|
26
26
|
|
|
27
27
|
Qase JS Reporters can be configured in multiple ways:
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
* using a config file `qase.config.json`
|
|
30
|
+
* using environment variables
|
|
31
|
+
|
|
31
32
|
|
|
32
33
|
All configuration options are listed in the table below:
|
|
33
34
|
|
|
@@ -40,6 +41,10 @@ All configuration options are listed in the table below:
|
|
|
40
41
|
| Root suite | `rootSuite` | `QASE_ROOT_SUITE` | undefined | No | Any string |
|
|
41
42
|
| Enable debug logs | `debug` | `QASE_DEBUG` | `False` | No | `True`, `False` |
|
|
42
43
|
| Enable capture logs from `stdout` and `stderr` | `testops.defect` | `QASE_CAPTURE_LOGS` | `False` | No | `True`, `False` |
|
|
44
|
+
| Map test result statuses to different values (format: `fromStatus=toStatus`) | `statusMapping` | `QASE_STATUS_MAPPING` | undefined | No | Object mapping statuses (e.g., `{"invalid": "failed", "skipped": "passed"}`) |
|
|
45
|
+
| **Logging configuration** | | | | | |
|
|
46
|
+
| Enable/disable console output for reporter logs | `logging.console` | `QASE_LOGGING_CONSOLE` | `True` | No | `True`, `False` |
|
|
47
|
+
| Enable/disable file output for reporter logs | `logging.file` | `QASE_LOGGING_FILE` | Same as `debug` setting | No | `True`, `False` |
|
|
43
48
|
| **Qase Report configuration** | | | | | |
|
|
44
49
|
| Driver used for report mode | `report.driver` | `QASE_REPORT_DRIVER` | `local` | No | `local` |
|
|
45
50
|
| Path to save the report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | | |
|
|
@@ -63,7 +68,7 @@ All configuration options are listed in the table below:
|
|
|
63
68
|
| Configuration values to create/find in groups (format: `group1=value1,group2=value2`) | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | undefined | No | Comma-separated key=value pairs |
|
|
64
69
|
| Create configuration groups if they don't exist | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `false` | No | `True`, `False` |
|
|
65
70
|
|
|
66
|
-
### Example `qase.config.json` config
|
|
71
|
+
### Example `qase.config.json` config
|
|
67
72
|
|
|
68
73
|
```json
|
|
69
74
|
{
|
|
@@ -72,6 +77,14 @@ All configuration options are listed in the table below:
|
|
|
72
77
|
"debug": false,
|
|
73
78
|
"environment": "local",
|
|
74
79
|
"captureLogs": false,
|
|
80
|
+
"statusMapping": {
|
|
81
|
+
"invalid": "failed",
|
|
82
|
+
"skipped": "passed"
|
|
83
|
+
},
|
|
84
|
+
"logging": {
|
|
85
|
+
"console": true,
|
|
86
|
+
"file": true
|
|
87
|
+
},
|
|
75
88
|
"report": {
|
|
76
89
|
"driver": "local",
|
|
77
90
|
"connection": {
|
|
@@ -120,7 +133,7 @@ All configuration options are listed in the table below:
|
|
|
120
133
|
}
|
|
121
134
|
```
|
|
122
135
|
|
|
123
|
-
### Environment Variables Example
|
|
136
|
+
### Environment Variables Example
|
|
124
137
|
|
|
125
138
|
```bash
|
|
126
139
|
# Set external link for Jira Cloud
|
|
@@ -131,4 +144,11 @@ export QASE_TESTOPS_RUN_EXTERNAL_LINK='{"type":"jiraServer","link":"PROJ-456"}'
|
|
|
131
144
|
|
|
132
145
|
# Filter out test results with specific statuses
|
|
133
146
|
export QASE_TESTOPS_STATUS_FILTER="passed,failed"
|
|
147
|
+
|
|
148
|
+
# Map test result statuses
|
|
149
|
+
export QASE_STATUS_MAPPING="invalid=failed,skipped=passed"
|
|
150
|
+
|
|
151
|
+
# Logging configuration
|
|
152
|
+
export QASE_LOGGING_CONSOLE=false # Disable console output
|
|
153
|
+
export QASE_LOGGING_FILE=true # Enable file output
|
|
134
154
|
```
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# qase-javascript-commons@2.4.6
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Added ability to control logging to console and file using the `logging` configuration option.
|
|
6
|
+
|
|
7
|
+
# qase-javascript-commons@2.4.5
|
|
8
|
+
|
|
9
|
+
## What's new
|
|
10
|
+
|
|
11
|
+
Added support for status mapping in the test run.
|
|
12
|
+
You can now map test result statuses to different values.
|
|
13
|
+
|
|
1
14
|
# qase-javascript-commons@2.4.4
|
|
2
15
|
|
|
3
16
|
## What's new
|
package/dist/client/dateUtils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.formatUTCDate = formatUTCDate;
|
|
4
|
+
exports.getStartTime = getStartTime;
|
|
4
5
|
// Utils
|
|
5
6
|
const pad = (num) => num.toString().padStart(2, '0');
|
|
6
7
|
function formatUTCDate(date) {
|
|
@@ -12,9 +13,7 @@ function formatUTCDate(date) {
|
|
|
12
13
|
const seconds = pad(date.getUTCSeconds());
|
|
13
14
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
14
15
|
}
|
|
15
|
-
exports.formatUTCDate = formatUTCDate;
|
|
16
16
|
function getStartTime() {
|
|
17
17
|
const date = new Date();
|
|
18
18
|
return formatUTCDate(new Date(date.getTime() - 10000));
|
|
19
19
|
}
|
|
20
|
-
exports.getStartTime = getStartTime;
|
|
@@ -33,6 +33,27 @@ export declare const configValidationSchema: {
|
|
|
33
33
|
type: string;
|
|
34
34
|
nullable: boolean;
|
|
35
35
|
};
|
|
36
|
+
statusMapping: {
|
|
37
|
+
type: string;
|
|
38
|
+
nullable: boolean;
|
|
39
|
+
additionalProperties: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
logging: {
|
|
44
|
+
type: string;
|
|
45
|
+
nullable: boolean;
|
|
46
|
+
properties: {
|
|
47
|
+
console: {
|
|
48
|
+
type: string;
|
|
49
|
+
nullable: boolean;
|
|
50
|
+
};
|
|
51
|
+
file: {
|
|
52
|
+
type: string;
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
36
57
|
testops: {
|
|
37
58
|
type: string;
|
|
38
59
|
nullable: boolean;
|
|
@@ -36,6 +36,27 @@ exports.configValidationSchema = {
|
|
|
36
36
|
type: 'string',
|
|
37
37
|
nullable: true,
|
|
38
38
|
},
|
|
39
|
+
statusMapping: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
nullable: true,
|
|
42
|
+
additionalProperties: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
logging: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
nullable: true,
|
|
49
|
+
properties: {
|
|
50
|
+
console: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
nullable: true,
|
|
53
|
+
},
|
|
54
|
+
file: {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
nullable: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
39
60
|
testops: {
|
|
40
61
|
type: 'object',
|
|
41
62
|
nullable: true,
|
package/dist/env/env-enum.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare enum EnvEnum {
|
|
|
7
7
|
debug = "QASE_DEBUG",
|
|
8
8
|
environment = "QASE_ENVIRONMENT",
|
|
9
9
|
captureLogs = "QASE_CAPTURE_LOGS",
|
|
10
|
-
rootSuite = "QASE_ROOT_SUITE"
|
|
10
|
+
rootSuite = "QASE_ROOT_SUITE",
|
|
11
|
+
statusMapping = "QASE_STATUS_MAPPING"
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* @enum {string}
|
|
@@ -62,3 +63,10 @@ export declare enum EnvLocalEnum {
|
|
|
62
63
|
path = "QASE_REPORT_CONNECTION_PATH",
|
|
63
64
|
format = "QASE_REPORT_CONNECTION_FORMAT"
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @enum {string}
|
|
68
|
+
*/
|
|
69
|
+
export declare enum EnvLoggingEnum {
|
|
70
|
+
console = "QASE_LOGGING_CONSOLE",
|
|
71
|
+
file = "QASE_LOGGING_FILE"
|
|
72
|
+
}
|
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.EnvConfigurationsEnum = exports.EnvBatchEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
3
|
+
exports.EnvLoggingEnum = exports.EnvLocalEnum = exports.EnvConfigurationsEnum = exports.EnvBatchEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @enum {string}
|
|
6
6
|
*/
|
|
@@ -12,6 +12,7 @@ var EnvEnum;
|
|
|
12
12
|
EnvEnum["environment"] = "QASE_ENVIRONMENT";
|
|
13
13
|
EnvEnum["captureLogs"] = "QASE_CAPTURE_LOGS";
|
|
14
14
|
EnvEnum["rootSuite"] = "QASE_ROOT_SUITE";
|
|
15
|
+
EnvEnum["statusMapping"] = "QASE_STATUS_MAPPING";
|
|
15
16
|
})(EnvEnum || (exports.EnvEnum = EnvEnum = {}));
|
|
16
17
|
/**
|
|
17
18
|
* @enum {string}
|
|
@@ -73,3 +74,11 @@ var EnvLocalEnum;
|
|
|
73
74
|
EnvLocalEnum["path"] = "QASE_REPORT_CONNECTION_PATH";
|
|
74
75
|
EnvLocalEnum["format"] = "QASE_REPORT_CONNECTION_FORMAT";
|
|
75
76
|
})(EnvLocalEnum || (exports.EnvLocalEnum = EnvLocalEnum = {}));
|
|
77
|
+
/**
|
|
78
|
+
* @enum {string}
|
|
79
|
+
*/
|
|
80
|
+
var EnvLoggingEnum;
|
|
81
|
+
(function (EnvLoggingEnum) {
|
|
82
|
+
EnvLoggingEnum["console"] = "QASE_LOGGING_CONSOLE";
|
|
83
|
+
EnvLoggingEnum["file"] = "QASE_LOGGING_FILE";
|
|
84
|
+
})(EnvLoggingEnum || (exports.EnvLoggingEnum = EnvLoggingEnum = {}));
|
|
@@ -13,6 +13,11 @@ const envToConfig = (env) => ({
|
|
|
13
13
|
environment: env[env_enum_1.EnvEnum.environment],
|
|
14
14
|
captureLogs: env[env_enum_1.EnvEnum.captureLogs],
|
|
15
15
|
rootSuite: env[env_enum_1.EnvEnum.rootSuite],
|
|
16
|
+
statusMapping: env[env_enum_1.EnvEnum.statusMapping] ?
|
|
17
|
+
Object.fromEntries(env[env_enum_1.EnvEnum.statusMapping].split(',').map(item => {
|
|
18
|
+
const [from, to] = item.split('=');
|
|
19
|
+
return [from?.trim() || '', to?.trim() || ''];
|
|
20
|
+
})) : undefined,
|
|
16
21
|
testops: {
|
|
17
22
|
project: env[env_enum_1.EnvTestOpsEnum.project],
|
|
18
23
|
uploadAttachments: env[env_enum_1.EnvTestOpsEnum.uploadAttachments],
|
|
@@ -70,5 +75,9 @@ const envToConfig = (env) => ({
|
|
|
70
75
|
},
|
|
71
76
|
},
|
|
72
77
|
},
|
|
78
|
+
logging: (env[env_enum_1.EnvLoggingEnum.console] !== undefined || env[env_enum_1.EnvLoggingEnum.file] !== undefined) ? {
|
|
79
|
+
console: env[env_enum_1.EnvLoggingEnum.console],
|
|
80
|
+
file: env[env_enum_1.EnvLoggingEnum.file],
|
|
81
|
+
} : undefined,
|
|
73
82
|
});
|
|
74
83
|
exports.envToConfig = envToConfig;
|
package/dist/env/env-type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum, EnvBatchEnum, EnvConfigurationsEnum } from './env-enum';
|
|
1
|
+
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum, EnvBatchEnum, EnvConfigurationsEnum, EnvLoggingEnum } from './env-enum';
|
|
2
2
|
import { ModeEnum } from '../options';
|
|
3
3
|
import { FormatEnum } from '../writer';
|
|
4
4
|
export interface EnvType {
|
|
@@ -8,6 +8,7 @@ export interface EnvType {
|
|
|
8
8
|
[EnvEnum.environment]?: string;
|
|
9
9
|
[EnvEnum.captureLogs]?: boolean;
|
|
10
10
|
[EnvEnum.rootSuite]?: string;
|
|
11
|
+
[EnvEnum.statusMapping]?: string;
|
|
11
12
|
[EnvTestOpsEnum.project]?: string;
|
|
12
13
|
[EnvTestOpsEnum.uploadAttachments]?: boolean;
|
|
13
14
|
[EnvTestOpsEnum.defect]?: boolean;
|
|
@@ -26,4 +27,6 @@ export interface EnvType {
|
|
|
26
27
|
[EnvConfigurationsEnum.createIfNotExists]?: boolean;
|
|
27
28
|
[EnvLocalEnum.path]?: string;
|
|
28
29
|
[EnvLocalEnum.format]?: `${FormatEnum}`;
|
|
30
|
+
[EnvLoggingEnum.console]?: boolean;
|
|
31
|
+
[EnvLoggingEnum.file]?: boolean;
|
|
29
32
|
}
|
|
@@ -36,6 +36,10 @@ exports.envValidationSchema = {
|
|
|
36
36
|
type: 'string',
|
|
37
37
|
nullable: true,
|
|
38
38
|
},
|
|
39
|
+
[env_enum_1.EnvEnum.statusMapping]: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
nullable: true,
|
|
42
|
+
},
|
|
39
43
|
[env_enum_1.EnvTestOpsEnum.project]: {
|
|
40
44
|
type: 'string',
|
|
41
45
|
nullable: true,
|
|
@@ -109,5 +113,13 @@ exports.envValidationSchema = {
|
|
|
109
113
|
enum: [writer_1.FormatEnum.json, writer_1.FormatEnum.jsonp],
|
|
110
114
|
nullable: true,
|
|
111
115
|
},
|
|
116
|
+
[env_enum_1.EnvLoggingEnum.console]: {
|
|
117
|
+
type: 'boolean',
|
|
118
|
+
nullable: true,
|
|
119
|
+
},
|
|
120
|
+
[env_enum_1.EnvLoggingEnum.file]: {
|
|
121
|
+
type: 'boolean',
|
|
122
|
+
nullable: true,
|
|
123
|
+
},
|
|
112
124
|
},
|
|
113
125
|
};
|
|
@@ -11,6 +11,10 @@ export type AdditionalReportOptionsType = {
|
|
|
11
11
|
driver?: `${DriverEnum}`;
|
|
12
12
|
connections?: ConnectionsType;
|
|
13
13
|
};
|
|
14
|
+
export type LoggingOptionsType = {
|
|
15
|
+
console?: boolean | undefined;
|
|
16
|
+
file?: boolean | undefined;
|
|
17
|
+
};
|
|
14
18
|
export type OptionsType = {
|
|
15
19
|
frameworkPackage: string;
|
|
16
20
|
frameworkName: string;
|
|
@@ -21,6 +25,8 @@ export type OptionsType = {
|
|
|
21
25
|
debug?: boolean | undefined;
|
|
22
26
|
environment?: string | undefined;
|
|
23
27
|
rootSuite?: string | undefined;
|
|
28
|
+
statusMapping?: Record<string, string> | undefined;
|
|
29
|
+
logging?: RecursivePartial<LoggingOptionsType> | undefined;
|
|
24
30
|
testops?: RecursivePartial<TestOpsOptionsType> | undefined;
|
|
25
31
|
report?: RecursivePartial<AdditionalReportOptionsType> | undefined;
|
|
26
32
|
};
|
package/dist/qase.d.ts
CHANGED
|
@@ -65,6 +65,11 @@ export declare class QaseReporter implements ReporterInterface {
|
|
|
65
65
|
* @returns {QaseReporter}
|
|
66
66
|
*/
|
|
67
67
|
static getInstance(options: OptionsType): QaseReporter;
|
|
68
|
+
/**
|
|
69
|
+
* Get status mapping configuration
|
|
70
|
+
* @returns Status mapping configuration or undefined
|
|
71
|
+
*/
|
|
72
|
+
getStatusMapping(): Record<string, string> | undefined;
|
|
68
73
|
/**
|
|
69
74
|
* @param {TestResultType} result
|
|
70
75
|
*/
|
package/dist/qase.js
CHANGED
|
@@ -16,6 +16,7 @@ const logger_1 = require("./utils/logger");
|
|
|
16
16
|
const state_1 = require("./state/state");
|
|
17
17
|
const hostData_1 = require("./utils/hostData");
|
|
18
18
|
const clientV2_1 = require("./client/clientV2");
|
|
19
|
+
const status_mapping_utils_1 = require("./utils/status-mapping-utils");
|
|
19
20
|
/**
|
|
20
21
|
* @type {Record<TestStatusEnum, (test: TestResultType) => string>}
|
|
21
22
|
*/
|
|
@@ -81,7 +82,17 @@ class QaseReporter {
|
|
|
81
82
|
const env = (0, env_1.envToConfig)((0, env_schema_1.default)({ schema: env_1.envValidationSchema }));
|
|
82
83
|
const composedOptions = (0, options_1.composeOptions)(options, env);
|
|
83
84
|
this.options = composedOptions;
|
|
84
|
-
|
|
85
|
+
// Process logging options with backward compatibility
|
|
86
|
+
const loggerOptions = {
|
|
87
|
+
debug: composedOptions.debug,
|
|
88
|
+
};
|
|
89
|
+
if (composedOptions.logging?.console !== undefined) {
|
|
90
|
+
loggerOptions.consoleLogging = composedOptions.logging.console;
|
|
91
|
+
}
|
|
92
|
+
if (composedOptions.logging?.file !== undefined) {
|
|
93
|
+
loggerOptions.fileLogging = composedOptions.logging.file;
|
|
94
|
+
}
|
|
95
|
+
this.logger = new logger_1.Logger(loggerOptions);
|
|
85
96
|
this.logger.logDebug(`Config: ${JSON.stringify(this.sanitizeOptions(composedOptions))}`);
|
|
86
97
|
const hostData = (0, hostData_1.getHostInfo)(options.frameworkPackage, options.reporterName);
|
|
87
98
|
this.logger.logDebug(`Host data: ${JSON.stringify(hostData)}`);
|
|
@@ -276,11 +287,28 @@ class QaseReporter {
|
|
|
276
287
|
}
|
|
277
288
|
return QaseReporter.instance;
|
|
278
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Get status mapping configuration
|
|
292
|
+
* @returns Status mapping configuration or undefined
|
|
293
|
+
*/
|
|
294
|
+
getStatusMapping() {
|
|
295
|
+
return this.options.statusMapping;
|
|
296
|
+
}
|
|
279
297
|
/**
|
|
280
298
|
* @param {TestResultType} result
|
|
281
299
|
*/
|
|
282
300
|
async addTestResult(result) {
|
|
283
301
|
if (!this.disabled) {
|
|
302
|
+
// Apply status mapping if configured
|
|
303
|
+
const statusMapping = this.getStatusMapping();
|
|
304
|
+
if (statusMapping) {
|
|
305
|
+
const originalStatus = result.execution.status;
|
|
306
|
+
const mappedStatus = (0, status_mapping_utils_1.applyStatusMapping)(originalStatus, statusMapping);
|
|
307
|
+
if (mappedStatus !== originalStatus) {
|
|
308
|
+
this.logger.logDebug(`Status mapping applied: ${originalStatus} -> ${mappedStatus}`);
|
|
309
|
+
result.execution.status = mappedStatus;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
284
312
|
// Check if result should be filtered out based on status
|
|
285
313
|
if (this.shouldFilterResult(result)) {
|
|
286
314
|
this.logger.logDebug(`Filtering out test result with status: ${result.execution.status}`);
|
package/dist/utils/hostData.js
CHANGED
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getHostInfo =
|
|
36
|
+
exports.getHostInfo = getHostInfo;
|
|
27
37
|
const os = __importStar(require("os"));
|
|
28
38
|
const cp = __importStar(require("child_process"));
|
|
29
39
|
const fs = __importStar(require("fs"));
|
|
@@ -188,4 +198,3 @@ function getHostInfo(framework, reporterName) {
|
|
|
188
198
|
};
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
|
-
exports.getHostInfo = getHostInfo;
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -6,9 +6,13 @@ export interface LoggerInterface {
|
|
|
6
6
|
export declare class Logger implements LoggerInterface {
|
|
7
7
|
private readonly debug;
|
|
8
8
|
private readonly filePath;
|
|
9
|
+
private readonly consoleEnabled;
|
|
10
|
+
private readonly fileEnabled;
|
|
9
11
|
constructor(options: {
|
|
10
12
|
debug?: boolean | undefined;
|
|
11
13
|
dir?: string;
|
|
14
|
+
consoleLogging?: boolean | undefined;
|
|
15
|
+
fileLogging?: boolean | undefined;
|
|
12
16
|
});
|
|
13
17
|
log(message: string): void;
|
|
14
18
|
logError(message: string, error?: unknown): void;
|
package/dist/utils/logger.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.Logger = void 0;
|
|
27
37
|
const fs = __importStar(require("fs"));
|
|
@@ -31,33 +41,47 @@ const qase_error_1 = require("./qase-error");
|
|
|
31
41
|
class Logger {
|
|
32
42
|
debug;
|
|
33
43
|
filePath;
|
|
44
|
+
consoleEnabled;
|
|
45
|
+
fileEnabled;
|
|
34
46
|
constructor(options) {
|
|
35
47
|
this.debug = options.debug;
|
|
48
|
+
// Determine console logging: if explicitly set, use that value; otherwise default to true
|
|
49
|
+
this.consoleEnabled = options.consoleLogging !== undefined ? options.consoleLogging : true;
|
|
50
|
+
// Determine file logging: if explicitly set, use that value; otherwise use debug setting
|
|
51
|
+
this.fileEnabled = options.fileLogging !== undefined ? options.fileLogging : (this.debug ?? false);
|
|
36
52
|
const dir = options.dir ?? './logs';
|
|
37
|
-
if (!fs.existsSync(dir)) {
|
|
53
|
+
if (this.fileEnabled && !fs.existsSync(dir)) {
|
|
38
54
|
fs.mkdirSync(dir);
|
|
39
55
|
}
|
|
40
56
|
this.filePath = path.join(dir, 'log.txt');
|
|
41
57
|
}
|
|
42
58
|
log(message) {
|
|
43
59
|
const logMessage = `[INFO] qase: ${message}`;
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
if (this.consoleEnabled) {
|
|
61
|
+
console.log(logMessage);
|
|
62
|
+
}
|
|
63
|
+
if (this.fileEnabled) {
|
|
46
64
|
this.logToFile(logMessage);
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
logError(message, error) {
|
|
50
68
|
const logMessage = `[ERROR] qase: ${this.doLogError(message, error)}`;
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
if (this.consoleEnabled) {
|
|
70
|
+
console.error(logMessage);
|
|
71
|
+
}
|
|
72
|
+
if (this.fileEnabled) {
|
|
53
73
|
this.logToFile(logMessage);
|
|
54
74
|
}
|
|
55
75
|
}
|
|
56
76
|
logDebug(message) {
|
|
57
77
|
if (this.debug) {
|
|
58
78
|
const logMessage = `[DEBUG] qase: ${message}`;
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
if (this.consoleEnabled) {
|
|
80
|
+
console.log(logMessage);
|
|
81
|
+
}
|
|
82
|
+
if (this.fileEnabled) {
|
|
83
|
+
this.logToFile(logMessage);
|
|
84
|
+
}
|
|
61
85
|
}
|
|
62
86
|
}
|
|
63
87
|
logToFile(message) {
|
package/dist/utils/mimeTypes.js
CHANGED
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getMimeTypes =
|
|
36
|
+
exports.getMimeTypes = getMimeTypes;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
28
38
|
const mime = __importStar(require("mime-types"));
|
|
29
39
|
/**
|
|
@@ -38,4 +48,3 @@ function getMimeTypes(filePath) {
|
|
|
38
48
|
}
|
|
39
49
|
return mimeType;
|
|
40
50
|
}
|
|
41
|
-
exports.getMimeTypes = getMimeTypes;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TestStatusEnum } from '../models/test-execution';
|
|
2
|
+
/**
|
|
3
|
+
* Applies status mapping configuration to a test status
|
|
4
|
+
* @param status - Original test status
|
|
5
|
+
* @param statusMapping - Status mapping configuration
|
|
6
|
+
* @returns Mapped test status or original if no mapping found
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyStatusMapping(status: TestStatusEnum, statusMapping?: Record<string, string>): TestStatusEnum;
|
|
9
|
+
/**
|
|
10
|
+
* Validates status mapping configuration
|
|
11
|
+
* @param statusMapping - Status mapping configuration to validate
|
|
12
|
+
* @returns Array of validation errors (empty if valid)
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateStatusMapping(statusMapping: Record<string, string>): string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyStatusMapping = applyStatusMapping;
|
|
4
|
+
exports.validateStatusMapping = validateStatusMapping;
|
|
5
|
+
const test_execution_1 = require("../models/test-execution");
|
|
6
|
+
/**
|
|
7
|
+
* Applies status mapping configuration to a test status
|
|
8
|
+
* @param status - Original test status
|
|
9
|
+
* @param statusMapping - Status mapping configuration
|
|
10
|
+
* @returns Mapped test status or original if no mapping found
|
|
11
|
+
*/
|
|
12
|
+
function applyStatusMapping(status, statusMapping) {
|
|
13
|
+
if (!statusMapping) {
|
|
14
|
+
return status;
|
|
15
|
+
}
|
|
16
|
+
const mappedStatus = statusMapping[status];
|
|
17
|
+
if (!mappedStatus) {
|
|
18
|
+
return status;
|
|
19
|
+
}
|
|
20
|
+
// Validate that the mapped status is a valid TestStatusEnum value
|
|
21
|
+
const validStatuses = Object.values(test_execution_1.TestStatusEnum);
|
|
22
|
+
if (!validStatuses.includes(mappedStatus)) {
|
|
23
|
+
console.warn(`Invalid status mapping: "${status}" -> "${mappedStatus}". Valid statuses are: ${validStatuses.join(', ')}`);
|
|
24
|
+
return status;
|
|
25
|
+
}
|
|
26
|
+
return mappedStatus;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validates status mapping configuration
|
|
30
|
+
* @param statusMapping - Status mapping configuration to validate
|
|
31
|
+
* @returns Array of validation errors (empty if valid)
|
|
32
|
+
*/
|
|
33
|
+
function validateStatusMapping(statusMapping) {
|
|
34
|
+
const errors = [];
|
|
35
|
+
const validStatuses = Object.values(test_execution_1.TestStatusEnum);
|
|
36
|
+
for (const [fromStatus, toStatus] of Object.entries(statusMapping)) {
|
|
37
|
+
if (!validStatuses.includes(fromStatus)) {
|
|
38
|
+
errors.push(`Invalid source status "${fromStatus}". Valid statuses are: ${validStatuses.join(', ')}`);
|
|
39
|
+
}
|
|
40
|
+
if (!validStatuses.includes(toStatus)) {
|
|
41
|
+
errors.push(`Invalid target status "${toStatus}". Valid statuses are: ${validStatuses.join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return errors;
|
|
45
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determineTestStatus =
|
|
3
|
+
exports.determineTestStatus = determineTestStatus;
|
|
4
4
|
const test_execution_1 = require("../models/test-execution");
|
|
5
5
|
/**
|
|
6
6
|
* Determines test status based on error type
|
|
@@ -20,7 +20,6 @@ function determineTestStatus(error, originalStatus) {
|
|
|
20
20
|
// For all other errors, return invalid
|
|
21
21
|
return test_execution_1.TestStatusEnum.invalid;
|
|
22
22
|
}
|
|
23
|
-
exports.determineTestStatus = determineTestStatus;
|
|
24
23
|
/**
|
|
25
24
|
* Checks if error is an assertion error
|
|
26
25
|
* @param error - Error object
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.JsonValidationError = void 0;
|
|
7
|
+
exports.validateJson = validateJson;
|
|
7
8
|
const ajv_1 = __importDefault(require("ajv"));
|
|
8
9
|
/**
|
|
9
10
|
* @type {Ajv}
|
|
@@ -38,4 +39,3 @@ function validateJson(schema, json) {
|
|
|
38
39
|
throw new JsonValidationError(validator.errors ? [...validator.errors] : []);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
exports.validateJson = validateJson;
|
package/dist/writer/fs-writer.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.FsWriter = void 0;
|
|
27
37
|
const fs_1 = require("fs");
|