@allurereport/plugin-testops 3.13.0 → 3.13.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/dist/client.d.ts +1 -0
- package/dist/client.js +8 -0
- package/dist/logger.d.ts +2 -2
- package/dist/logger.js +11 -4
- package/dist/plugin.js +21 -7
- package/package.json +9 -9
package/dist/client.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare class TestOpsClient {
|
|
|
27
27
|
startUpload(ci: CiDescriptor): Promise<void>;
|
|
28
28
|
stopUpload(ci: CiDescriptor, status: TestStatus): Promise<void>;
|
|
29
29
|
createLaunch(launchName: string, launchTags: string[], gitContext?: LaunchGitContextDto): Promise<void>;
|
|
30
|
+
checkLaunchProgress(): Promise<boolean>;
|
|
30
31
|
createSession(environment?: Record<string, unknown>): Promise<void>;
|
|
31
32
|
get namedEnvs(): MapIterator<TestOpsNamedEnv>;
|
|
32
33
|
getNamedEnvFor(id: string): TestOpsNamedEnv | undefined;
|
package/dist/client.js
CHANGED
|
@@ -168,6 +168,14 @@ export class TestOpsClient {
|
|
|
168
168
|
__classPrivateFieldSet(this, _TestOpsClient_launch, data, "f");
|
|
169
169
|
__classPrivateFieldGet(this, _TestOpsClient_logger, "f").debug(`Launch created: id=${bold(data.id.toString())}`);
|
|
170
170
|
}
|
|
171
|
+
async checkLaunchProgress() {
|
|
172
|
+
if (!__classPrivateFieldGet(this, _TestOpsClient_launch, "f")) {
|
|
173
|
+
throw new Error("Launch isn't created! Call createLaunch first");
|
|
174
|
+
}
|
|
175
|
+
__classPrivateFieldGet(this, _TestOpsClient_logger, "f").verbose("Retrieving launch progress status…");
|
|
176
|
+
const data = await __classPrivateFieldGet(this, _TestOpsClient_client, "f").get(`/api/launch/${__classPrivateFieldGet(this, _TestOpsClient_launch, "f").id}/progress`);
|
|
177
|
+
return data.ready;
|
|
178
|
+
}
|
|
171
179
|
async createSession(environment = {}) {
|
|
172
180
|
if (!__classPrivateFieldGet(this, _TestOpsClient_launch, "f")) {
|
|
173
181
|
throw new Error("Launch isn't created! Call createLaunch first");
|
package/dist/logger.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import ProgressBar from "progress";
|
|
|
2
2
|
type JSONMessage = Record<string, unknown> | Array<unknown>;
|
|
3
3
|
export declare class Logger {
|
|
4
4
|
#private;
|
|
5
|
-
readonly
|
|
6
|
-
constructor(
|
|
5
|
+
private readonly loggerName;
|
|
6
|
+
constructor(loggerName: string);
|
|
7
7
|
progressBarCounter(message: string, total: number): ProgressBar | {
|
|
8
8
|
tick: () => void;
|
|
9
9
|
update: () => void;
|
package/dist/logger.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
1
7
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
11
|
};
|
|
6
|
-
var _Logger_instances, _Logger_level, _Logger_isLogLevel, _Logger_isSilent
|
|
12
|
+
var _Logger_instances, _Logger_level, _Logger_prefix, _Logger_isLogLevel, _Logger_isSilent;
|
|
7
13
|
import console from "node:console";
|
|
8
14
|
import { env } from "node:process";
|
|
9
15
|
import { inspect } from "node:util";
|
|
@@ -30,11 +36,12 @@ function getLogLevelFromEnv() {
|
|
|
30
36
|
return "info";
|
|
31
37
|
}
|
|
32
38
|
export class Logger {
|
|
33
|
-
constructor(
|
|
39
|
+
constructor(loggerName) {
|
|
34
40
|
_Logger_instances.add(this);
|
|
35
|
-
this.
|
|
41
|
+
this.loggerName = loggerName;
|
|
36
42
|
_Logger_level.set(this, getLogLevelFromEnv());
|
|
37
|
-
_Logger_prefix.set(this,
|
|
43
|
+
_Logger_prefix.set(this, void 0);
|
|
44
|
+
__classPrivateFieldSet(this, _Logger_prefix, cyan(bold(`[${this.loggerName}]:`)), "f");
|
|
38
45
|
}
|
|
39
46
|
progressBarCounter(message, total) {
|
|
40
47
|
if (__classPrivateFieldGet(this, _Logger_instances, "m", _Logger_isSilent).call(this)) {
|
package/dist/plugin.js
CHANGED
|
@@ -22,6 +22,8 @@ import { Logger } from "./logger.js";
|
|
|
22
22
|
import { attachmentsResolverFactory, fixturesResolverFactory, resolvePluginOptions, unwrapStepsAttachments, } from "./utils/index.js";
|
|
23
23
|
import { toUploadCategory } from "./utils/uploadCategory.js";
|
|
24
24
|
import { uploadFilenameForLink } from "./utils/uploaderDto.js";
|
|
25
|
+
const LAUNCH_PROGRESS_POLL_DELAY_MS = 500;
|
|
26
|
+
const LAUNCH_PROGRESS_ATTEMPTS_LIMIT = 10;
|
|
25
27
|
const categoryDisplayName = (cat) => cat.name ?? cat.grouping?.[0]?.name ?? cat.grouping?.[0]?.value ?? cat.grouping?.[0]?.key ?? cat.externalId;
|
|
26
28
|
export class TestOpsPlugin {
|
|
27
29
|
constructor(options, context = {}) {
|
|
@@ -132,15 +134,27 @@ export class TestOpsPlugin {
|
|
|
132
134
|
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").info(`Upload finished. Allure TestOps Launch: ${__classPrivateFieldGet(this, _TestOpsPlugin_client, "f").launchUrl}`);
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
let launchIsReady = false;
|
|
138
|
+
for (let attempt = 0; attempt < LAUNCH_PROGRESS_ATTEMPTS_LIMIT; attempt += 1) {
|
|
139
|
+
launchIsReady = await __classPrivateFieldGet(this, _TestOpsPlugin_client, "f").checkLaunchProgress();
|
|
140
|
+
if (launchIsReady) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
if (attempt < LAUNCH_PROGRESS_ATTEMPTS_LIMIT - 1) {
|
|
144
|
+
await new Promise((resolve) => setTimeout(resolve, LAUNCH_PROGRESS_POLL_DELAY_MS));
|
|
145
|
+
}
|
|
137
146
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
__classPrivateFieldGet(this,
|
|
147
|
+
if (launchIsReady) {
|
|
148
|
+
try {
|
|
149
|
+
await __classPrivateFieldGet(this, _TestOpsPlugin_client, "f").closeLaunch(launchId);
|
|
141
150
|
}
|
|
142
|
-
|
|
143
|
-
|
|
151
|
+
catch (err) {
|
|
152
|
+
if (err instanceof Error) {
|
|
153
|
+
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug(`Failed to close launch: ${err.message}`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug("Failed to close launch");
|
|
157
|
+
}
|
|
144
158
|
}
|
|
145
159
|
}
|
|
146
160
|
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").info(`Upload finished. Allure TestOps Launch: ${__classPrivateFieldGet(this, _TestOpsPlugin_client, "f").launchUrl}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-testops",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"description": "Allure Plugin TestOps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@allurereport/ci": "3.13.
|
|
36
|
-
"@allurereport/core-api": "3.13.
|
|
37
|
-
"@allurereport/git": "3.13.
|
|
38
|
-
"@allurereport/plugin-api": "3.13.
|
|
39
|
-
"@allurereport/reader-api": "3.13.
|
|
40
|
-
"@allurereport/service": "3.13.
|
|
41
|
-
"axios": "^1.
|
|
42
|
-
"form-data": "^4.0.
|
|
35
|
+
"@allurereport/ci": "3.13.2",
|
|
36
|
+
"@allurereport/core-api": "3.13.2",
|
|
37
|
+
"@allurereport/git": "3.13.2",
|
|
38
|
+
"@allurereport/plugin-api": "3.13.2",
|
|
39
|
+
"@allurereport/reader-api": "3.13.2",
|
|
40
|
+
"@allurereport/service": "3.13.2",
|
|
41
|
+
"axios": "^1.18.1",
|
|
42
|
+
"form-data": "^4.0.6",
|
|
43
43
|
"lodash-es": "^4.18.1",
|
|
44
44
|
"p-limit": "^7.3.0",
|
|
45
45
|
"progress": "^2.0.3",
|