@allurereport/core 3.8.2 → 3.10.0
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/api.d.ts +3 -2
- package/dist/config.d.ts +4 -1
- package/dist/config.js +24 -9
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +10 -4
- package/dist/report.d.ts +1 -0
- package/dist/report.js +499 -372
- package/dist/store/convert.js +1 -1
- package/dist/store/retrySubstore.d.ts +12 -0
- package/dist/store/retrySubstore.js +94 -0
- package/dist/store/store.d.ts +9 -4
- package/dist/store/store.js +95 -137
- package/dist/utils/cli.d.ts +4 -0
- package/dist/utils/cli.js +41 -0
- package/dist/utils/crypto.d.ts +1 -0
- package/dist/utils/crypto.js +2 -1
- package/dist/utils/perf.d.ts +42 -0
- package/dist/utils/perf.js +122 -0
- package/dist/utils/realtimeUpdateScheduler.js +5 -0
- package/package.json +28 -30
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CategoriesConfig, KnownTestFailure } from "@allurereport/core-api";
|
|
1
|
+
import type { CategoriesConfig, KnownTestFailure, ResolvedAllureServiceConfig } from "@allurereport/core-api";
|
|
2
2
|
import type { Plugin, ReportFiles, Config } from "@allurereport/plugin-api";
|
|
3
3
|
import type { ResultsReader } from "@allurereport/reader-api";
|
|
4
4
|
export interface PluginInstance {
|
|
@@ -8,7 +8,7 @@ export interface PluginInstance {
|
|
|
8
8
|
options: Record<string, any>;
|
|
9
9
|
}
|
|
10
10
|
type FullConfigRequiredFromConfig = Required<Pick<Config, "name" | "output" | "open" | "knownIssuesPath">>;
|
|
11
|
-
export interface FullConfig extends Omit<Config, "name" | "output" | "open" | "knownIssuesPath" | "plugins" | "port">, FullConfigRequiredFromConfig {
|
|
11
|
+
export interface FullConfig extends Omit<Config, "name" | "output" | "open" | "knownIssuesPath" | "plugins" | "port" | "allureService">, FullConfigRequiredFromConfig {
|
|
12
12
|
port: Config["port"] | undefined;
|
|
13
13
|
allowedEnvironments?: Config["allowedEnvironments"];
|
|
14
14
|
reportFiles: ReportFiles;
|
|
@@ -17,6 +17,7 @@ export interface FullConfig extends Omit<Config, "name" | "output" | "open" | "k
|
|
|
17
17
|
known?: KnownTestFailure[];
|
|
18
18
|
realTime?: any;
|
|
19
19
|
qualityGate?: Config["qualityGate"];
|
|
20
|
+
allureService?: ResolvedAllureServiceConfig;
|
|
20
21
|
categories?: CategoriesConfig;
|
|
21
22
|
globalAttachments?: string[];
|
|
22
23
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config } from "@allurereport/plugin-api";
|
|
1
|
+
import type { Config, PluginDescriptor } from "@allurereport/plugin-api";
|
|
2
2
|
import type { FullConfig, PluginInstance } from "./api.js";
|
|
3
3
|
export interface ConfigOverride {
|
|
4
4
|
name?: Config["name"];
|
|
@@ -11,6 +11,9 @@ export interface ConfigOverride {
|
|
|
11
11
|
knownIssuesPath?: Config["knownIssuesPath"];
|
|
12
12
|
plugins?: Config["plugins"];
|
|
13
13
|
}
|
|
14
|
+
export declare const parseIntegerConfigValue: (value: unknown, defaultValue: number, minValue: number) => number;
|
|
15
|
+
export declare const isAgentDescriptor: (value: string | undefined) => value is "agent" | "@allurereport/plugin-agent";
|
|
16
|
+
export declare const hasConfiguredAgent: (plugins: Record<string, PluginDescriptor>) => boolean;
|
|
14
17
|
export declare const assertValidPluginId: (id: string) => void;
|
|
15
18
|
export declare const getPluginId: (key: string) => string;
|
|
16
19
|
export declare const findConfig: (cwd: string, configPath?: string) => Promise<string | undefined>;
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as console from "node:console";
|
|
2
1
|
import { readFile, stat } from "node:fs/promises";
|
|
3
2
|
import { extname, resolve } from "node:path";
|
|
4
3
|
import * as process from "node:process";
|
|
@@ -19,10 +18,20 @@ const CONFIG_FILENAMES = [
|
|
|
19
18
|
"allurerc.yml",
|
|
20
19
|
];
|
|
21
20
|
const DEFAULT_CONFIG = {};
|
|
22
|
-
const
|
|
21
|
+
const DEFAULT_ALLURE_SERVICE_UPLOAD_CONCURRENCY = 100;
|
|
22
|
+
const DEFAULT_ALLURE_SERVICE_UPLAOD_MAX_ATTEMPTS = 5;
|
|
23
|
+
const DEFAULT_ALLURE_SERVICE_UPLOAD_MAX_SIMULTANEOUS_FAILURES = 5;
|
|
24
|
+
export const parseIntegerConfigValue = (value, defaultValue, minValue) => {
|
|
25
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
26
|
+
return defaultValue;
|
|
27
|
+
}
|
|
28
|
+
const normalized = Math.floor(value);
|
|
29
|
+
return normalized >= minValue ? normalized : defaultValue;
|
|
30
|
+
};
|
|
31
|
+
export const isAgentDescriptor = (value) => {
|
|
23
32
|
return value === "agent" || value === "@allurereport/plugin-agent";
|
|
24
33
|
};
|
|
25
|
-
const hasConfiguredAgent = (plugins) => {
|
|
34
|
+
export const hasConfiguredAgent = (plugins) => {
|
|
26
35
|
return Object.entries(plugins).some(([key, descriptor]) => isAgentDescriptor(key) || isAgentDescriptor(descriptor.import));
|
|
27
36
|
};
|
|
28
37
|
export const assertValidPluginId = (id) => {
|
|
@@ -60,9 +69,7 @@ export const findConfig = async (cwd, configPath) => {
|
|
|
60
69
|
return resolved;
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
|
-
catch
|
|
64
|
-
console.error(e);
|
|
65
|
-
}
|
|
72
|
+
catch { }
|
|
66
73
|
throw new Error(`invalid config path ${resolved}: not a regular file`);
|
|
67
74
|
}
|
|
68
75
|
for (const configFilename of CONFIG_FILENAMES) {
|
|
@@ -200,7 +207,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
200
207
|
},
|
|
201
208
|
}
|
|
202
209
|
: configuredPlugins;
|
|
203
|
-
const
|
|
210
|
+
const pluginsWithAgent = hasConfiguredAgent(basePlugins)
|
|
204
211
|
? basePlugins
|
|
205
212
|
: {
|
|
206
213
|
...basePlugins,
|
|
@@ -208,7 +215,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
208
215
|
options: {},
|
|
209
216
|
},
|
|
210
217
|
};
|
|
211
|
-
pluginInstances = await resolvePlugins(
|
|
218
|
+
pluginInstances = await resolvePlugins(pluginsWithAgent);
|
|
212
219
|
}
|
|
213
220
|
return {
|
|
214
221
|
name,
|
|
@@ -229,7 +236,15 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
229
236
|
plugins: pluginInstances,
|
|
230
237
|
defaultLabels: config.defaultLabels ?? {},
|
|
231
238
|
qualityGate: config.qualityGate,
|
|
232
|
-
allureService: config.allureService
|
|
239
|
+
allureService: config.allureService
|
|
240
|
+
? {
|
|
241
|
+
accessToken: config.allureService.accessToken,
|
|
242
|
+
private: config.allureService.private,
|
|
243
|
+
uploadConcurrency: parseIntegerConfigValue(config.allureService.uploadConcurrency, DEFAULT_ALLURE_SERVICE_UPLOAD_CONCURRENCY, 1),
|
|
244
|
+
uploadMaxAttempts: parseIntegerConfigValue(config.allureService.uploadMaxAttempts, DEFAULT_ALLURE_SERVICE_UPLAOD_MAX_ATTEMPTS, 1),
|
|
245
|
+
uploadMaxSimultaneousFailures: parseIntegerConfigValue(config.allureService.uploadMaxSimultaneousFailures, DEFAULT_ALLURE_SERVICE_UPLOAD_MAX_SIMULTANEOUS_FAILURES, 0),
|
|
246
|
+
}
|
|
247
|
+
: undefined,
|
|
233
248
|
categories: config.categories,
|
|
234
249
|
globalAttachments: config.globalAttachments,
|
|
235
250
|
};
|
package/dist/plugin.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare class DefaultPluginState implements PluginState {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class PluginFiles implements ReportFiles {
|
|
10
10
|
#private;
|
|
11
|
-
readonly callback?: ((key: string, path: string) => void) | undefined;
|
|
12
|
-
constructor(parent: ReportFiles, pluginId: string, callback?: ((key: string, path: string) => void) | undefined);
|
|
11
|
+
readonly callback?: ((key: string, path: string) => void | Promise<void>) | undefined;
|
|
12
|
+
constructor(parent: ReportFiles, pluginId: string, callback?: ((key: string, path: string) => void | Promise<void>) | undefined);
|
|
13
13
|
addFile: (key: string, data: Buffer) => Promise<string>;
|
|
14
14
|
}
|
|
15
15
|
export declare class InMemoryReportFiles implements ReportFiles {
|
package/dist/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
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");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _DefaultPluginState_state, _PluginFiles_parent, _PluginFiles_pluginId, _InMemoryReportFiles_state, _FileSystemReportFiles_output;
|
|
12
|
+
var _DefaultPluginState_state, _PluginFiles_parent, _PluginFiles_pluginId, _InMemoryReportFiles_state, _FileSystemReportFiles_output, _FileSystemReportFiles_createdDirs;
|
|
13
13
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
14
14
|
import { dirname, resolve } from "node:path";
|
|
15
15
|
import { join as joinPosix } from "node:path/posix";
|
|
@@ -37,7 +37,7 @@ export class PluginFiles {
|
|
|
37
37
|
_PluginFiles_pluginId.set(this, void 0);
|
|
38
38
|
this.addFile = async (key, data) => {
|
|
39
39
|
const filepath = await __classPrivateFieldGet(this, _PluginFiles_parent, "f").addFile(joinPosix(__classPrivateFieldGet(this, _PluginFiles_pluginId, "f"), key), data);
|
|
40
|
-
this.callback?.(key, filepath);
|
|
40
|
+
await this.callback?.(key, filepath);
|
|
41
41
|
return filepath;
|
|
42
42
|
};
|
|
43
43
|
__classPrivateFieldSet(this, _PluginFiles_parent, parent, "f");
|
|
@@ -58,14 +58,20 @@ _InMemoryReportFiles_state = new WeakMap();
|
|
|
58
58
|
export class FileSystemReportFiles {
|
|
59
59
|
constructor(output) {
|
|
60
60
|
_FileSystemReportFiles_output.set(this, void 0);
|
|
61
|
+
_FileSystemReportFiles_createdDirs.set(this, new Map());
|
|
61
62
|
this.addFile = async (path, data) => {
|
|
62
63
|
const targetPath = resolvePathUnderOutputRoot(__classPrivateFieldGet(this, _FileSystemReportFiles_output, "f"), path);
|
|
63
64
|
const targetDirPath = dirname(targetPath);
|
|
64
|
-
|
|
65
|
+
let createdDir = __classPrivateFieldGet(this, _FileSystemReportFiles_createdDirs, "f").get(targetDirPath);
|
|
66
|
+
if (!createdDir) {
|
|
67
|
+
createdDir = mkdir(targetDirPath, { recursive: true });
|
|
68
|
+
__classPrivateFieldGet(this, _FileSystemReportFiles_createdDirs, "f").set(targetDirPath, createdDir);
|
|
69
|
+
}
|
|
70
|
+
await createdDir;
|
|
65
71
|
await writeFile(targetPath, data, { encoding: "utf-8" });
|
|
66
72
|
return targetPath;
|
|
67
73
|
};
|
|
68
74
|
__classPrivateFieldSet(this, _FileSystemReportFiles_output, resolve(output), "f");
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
|
-
_FileSystemReportFiles_output = new WeakMap();
|
|
77
|
+
_FileSystemReportFiles_output = new WeakMap(), _FileSystemReportFiles_createdDirs = new WeakMap();
|
package/dist/report.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { RealtimeEventsDispatcher, RealtimeSubscriber } from "./utils/event.js";
|
|
|
7
7
|
export declare class AllureReport {
|
|
8
8
|
#private;
|
|
9
9
|
readonly reportUuid: string;
|
|
10
|
+
readonly reportName: string;
|
|
10
11
|
reportUrl?: string;
|
|
11
12
|
constructor(opts: FullConfig);
|
|
12
13
|
get hasQualityGate(): boolean;
|