qase-javascript-commons 2.0.6 → 2.0.8
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 +12 -0
- package/dist/config/config-validation-schema.js +1 -1
- package/dist/env/env-type.d.ts +1 -1
- package/dist/env/env-validation-schema.js +1 -1
- package/dist/options/options-type.d.ts +1 -1
- package/dist/qase.js +4 -3
- package/dist/reporters/testops-reporter.d.ts +1 -1
- package/dist/reporters/testops-reporter.js +14 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# qase-javascript-commons@2.0.8
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Fixed an issue with creating a test run with environment when the reporter ignored the `environment` parameter in the configuration.
|
|
6
|
+
|
|
7
|
+
# qase-javascript-commons@2.0.7
|
|
8
|
+
|
|
9
|
+
## What's new
|
|
10
|
+
|
|
11
|
+
Fixed an issue with creating a defect for failed tests when the reporter ignored the `defect` parameter in the configuration.
|
|
12
|
+
|
|
1
13
|
# qase-javascript-commons@2.0.6
|
|
2
14
|
|
|
3
15
|
## What's new
|
package/dist/env/env-type.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type EnvType = {
|
|
|
5
5
|
[EnvEnum.mode]?: `${ModeEnum}`;
|
|
6
6
|
[EnvEnum.fallback]?: `${ModeEnum}`;
|
|
7
7
|
[EnvEnum.debug]?: boolean;
|
|
8
|
-
[EnvEnum.environment]?: string
|
|
8
|
+
[EnvEnum.environment]?: string;
|
|
9
9
|
[EnvEnum.captureLogs]?: boolean;
|
|
10
10
|
[EnvTestOpsEnum.project]?: string;
|
|
11
11
|
[EnvTestOpsEnum.uploadAttachments]?: boolean;
|
|
@@ -23,7 +23,7 @@ export type OptionsType = {
|
|
|
23
23
|
fallback?: `${ModeEnum}` | undefined;
|
|
24
24
|
captureLogs?: boolean | undefined;
|
|
25
25
|
debug?: boolean | undefined;
|
|
26
|
-
environment?: string |
|
|
26
|
+
environment?: string | undefined;
|
|
27
27
|
testops?: (RecursivePartial<TestOpsOptionsType> & AdditionalTestOpsOptionsType) | undefined;
|
|
28
28
|
report?: RecursivePartial<AdditionalReportOptionsType> | undefined;
|
|
29
29
|
};
|
package/dist/qase.js
CHANGED
|
@@ -252,7 +252,7 @@ class QaseReporter {
|
|
|
252
252
|
const { frameworkPackage, frameworkName, reporterName, environment, report = {}, testops = {}, } = options;
|
|
253
253
|
switch (mode) {
|
|
254
254
|
case options_1.ModeEnum.testops: {
|
|
255
|
-
const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {}, batch = {}, useV2, uploadAttachments, } = testops;
|
|
255
|
+
const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {}, batch = {}, useV2, defect, uploadAttachments, } = testops;
|
|
256
256
|
if (!token) {
|
|
257
257
|
throw new Error(`Either "testops.api.token" parameter or "${env_1.EnvApiEnum.token}" environment variable is required in "testops" mode`);
|
|
258
258
|
}
|
|
@@ -278,12 +278,13 @@ class QaseReporter {
|
|
|
278
278
|
plan,
|
|
279
279
|
batch,
|
|
280
280
|
useV2,
|
|
281
|
-
|
|
281
|
+
defect,
|
|
282
|
+
}, apiClient, environment);
|
|
282
283
|
}
|
|
283
284
|
case options_1.ModeEnum.report: {
|
|
284
285
|
const localOptions = report.connections?.[writer_1.DriverEnum.local];
|
|
285
286
|
const writer = new writer_1.FsWriter(localOptions);
|
|
286
|
-
return new reporters_1.ReportReporter(this.logger, writer,
|
|
287
|
+
return new reporters_1.ReportReporter(this.logger, writer, environment, testops.run?.id);
|
|
287
288
|
}
|
|
288
289
|
case options_1.ModeEnum.off:
|
|
289
290
|
throw new disabled_exception_1.DisabledException();
|
|
@@ -97,7 +97,7 @@ export declare class TestOpsReporter extends AbstractReporter {
|
|
|
97
97
|
* @param {QaseApiInterface} api
|
|
98
98
|
* @param {number} environment
|
|
99
99
|
*/
|
|
100
|
-
constructor(logger: LoggerInterface, options: TestOpsOptionsType, api: QaseApiInterface, environment?:
|
|
100
|
+
constructor(logger: LoggerInterface, options: TestOpsOptionsType, api: QaseApiInterface, environment?: string);
|
|
101
101
|
/**
|
|
102
102
|
* @returns {Promise<void>}
|
|
103
103
|
*/
|
|
@@ -79,7 +79,20 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
this.logger.logDebug('Create test run');
|
|
82
|
-
|
|
82
|
+
let environmentId;
|
|
83
|
+
if (this.environment != undefined) {
|
|
84
|
+
try {
|
|
85
|
+
const { data } = await this.api.environment.getEnvironments(this.projectCode, 100);
|
|
86
|
+
const env = data.result?.entities?.find((env) => env.slug === this.environment);
|
|
87
|
+
if (env) {
|
|
88
|
+
environmentId = env.id;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
throw new qase_error_1.QaseError('Cannot get environments', { cause: error });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const { result } = await this.createRun(this.run.title, this.run.description, environmentId);
|
|
83
96
|
if (!result?.id) {
|
|
84
97
|
throw new Error('Cannot create run.');
|
|
85
98
|
}
|