@allurereport/core 3.20.0 → 3.21.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/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/history.d.ts +0 -1
- package/dist/history.js +38 -14
- package/dist/report.d.ts +2 -1
- package/dist/report.js +74 -45
- package/dist/store/convert.js +47 -31
- package/dist/store/retrySubstore.js +7 -1
- package/dist/store/store.d.ts +1 -0
- package/dist/store/store.js +12 -4
- package/dist/utils/crypto.d.ts +1 -1
- package/dist/utils/crypto.js +2 -2
- package/package.json +28 -23
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -87,6 +87,7 @@ export const validateConfig = (config) => {
|
|
|
87
87
|
"output",
|
|
88
88
|
"open",
|
|
89
89
|
"port",
|
|
90
|
+
"host",
|
|
90
91
|
"hideLabels",
|
|
91
92
|
"historyPath",
|
|
92
93
|
"historyBaseUrl",
|
|
@@ -208,6 +209,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
208
209
|
const name = override.name ?? config.name ?? "Allure Report";
|
|
209
210
|
const open = override.open ?? config.open ?? false;
|
|
210
211
|
const port = override.port ?? config.port ?? undefined;
|
|
212
|
+
const host = override.host ?? config.host ?? undefined;
|
|
211
213
|
const hideLabels = override.hideLabels ?? config.hideLabels;
|
|
212
214
|
const historyPath = override.historyPath ?? config.historyPath;
|
|
213
215
|
const historyBaseUrl = override.historyBaseUrl ?? config.historyBaseUrl;
|
|
@@ -252,6 +254,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
252
254
|
output,
|
|
253
255
|
open,
|
|
254
256
|
port,
|
|
257
|
+
host,
|
|
255
258
|
hideLabels,
|
|
256
259
|
resolutions,
|
|
257
260
|
environment,
|
package/dist/history.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type AllureHistory, type HistoryDataPoint, type MetricSample, type TestCase, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
export declare const normalizeHistoryBaseUrl: (historyBaseUrl: string) => string;
|
|
3
|
-
export declare const setHistoryDataPointUrl: (point: HistoryDataPoint, url: string) => HistoryDataPoint;
|
|
4
3
|
export declare const createHistory: (reportUuid: string, reportName: string | undefined, testCases: TestCase[], testResults: TestResult[], remoteUrl?: string, metrics?: MetricSample[]) => HistoryDataPoint;
|
|
5
4
|
export declare class AllureLocalHistory implements AllureHistory {
|
|
6
5
|
#private;
|
package/dist/history.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
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");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _AllureLocalHistory_cachedHistory, _AllureLocalHistory_openFileToReadIfExists, _AllureLocalHistory_ensureFileOpenedToAppend, _AllureLocalHistory_findFirstEntryAddress, _AllureLocalHistory_throwUnexpectedReadError;
|
|
12
|
+
var _AllureLocalHistory_cachedHistory, _AllureLocalHistory_closeStreams, _AllureLocalHistory_openFileToReadIfExists, _AllureLocalHistory_ensureFileOpenedToAppend, _AllureLocalHistory_findFirstEntryAddress, _AllureLocalHistory_throwUnexpectedReadError;
|
|
13
13
|
import { once } from "node:events";
|
|
14
14
|
import { mkdir, open } from "node:fs/promises";
|
|
15
15
|
import path from "node:path";
|
|
@@ -20,13 +20,14 @@ import { isFileNotFoundError } from "./utils/misc.js";
|
|
|
20
20
|
const createHistoryItems = (testResults, remoteUrl) => {
|
|
21
21
|
return testResults
|
|
22
22
|
.filter((tr) => tr.retryHash)
|
|
23
|
-
.map(({ id, name, fullName, environment, retryHash, status, error: { message, trace } = {}, start, stop, duration, labels, }) => {
|
|
23
|
+
.map(({ id, name, fullName, environment, retryHash, status, retries = [], error: { message, trace } = {}, start, stop, duration, labels, }) => {
|
|
24
24
|
return {
|
|
25
25
|
id,
|
|
26
26
|
name,
|
|
27
27
|
fullName,
|
|
28
28
|
environment,
|
|
29
29
|
status,
|
|
30
|
+
retries: retries.map((retry) => retry.status).reverse(),
|
|
30
31
|
message,
|
|
31
32
|
trace,
|
|
32
33
|
start,
|
|
@@ -70,11 +71,6 @@ export const normalizeHistoryBaseUrl = (historyBaseUrl) => {
|
|
|
70
71
|
url.pathname = `${url.pathname.replace(/\/+$/u, "")}/`;
|
|
71
72
|
return url.toString();
|
|
72
73
|
};
|
|
73
|
-
export const setHistoryDataPointUrl = (point, url) => ({
|
|
74
|
-
...point,
|
|
75
|
-
url,
|
|
76
|
-
testResults: Object.fromEntries(Object.entries(point.testResults).map(([historyId, item]) => [historyId, { ...item, url }])),
|
|
77
|
-
});
|
|
78
74
|
export const createHistory = (reportUuid, reportName = "Allure Report", testCases, testResults, remoteUrl = "", metrics = []) => {
|
|
79
75
|
const knownTestCaseIds = testCases.map((tc) => tc.id);
|
|
80
76
|
return {
|
|
@@ -87,10 +83,35 @@ export const createHistory = (reportUuid, reportName = "Allure Report", testCase
|
|
|
87
83
|
url: remoteUrl,
|
|
88
84
|
};
|
|
89
85
|
};
|
|
86
|
+
const closeStream = async (stream) => {
|
|
87
|
+
if (stream.closed) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
await new Promise((resolve) => {
|
|
91
|
+
stream.once("error", () => { });
|
|
92
|
+
stream.once("close", () => resolve());
|
|
93
|
+
stream.destroy();
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const closeFileHandle = async (file) => {
|
|
97
|
+
try {
|
|
98
|
+
await file.close();
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
if (err?.code !== "EBADF") {
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
90
106
|
export class AllureLocalHistory {
|
|
91
107
|
constructor(params) {
|
|
92
108
|
this.params = params;
|
|
93
109
|
_AllureLocalHistory_cachedHistory.set(this, []);
|
|
110
|
+
_AllureLocalHistory_closeStreams.set(this, async (streams) => {
|
|
111
|
+
for (const stream of streams) {
|
|
112
|
+
await closeStream(stream);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
94
115
|
_AllureLocalHistory_openFileToReadIfExists.set(this, async (filePath) => {
|
|
95
116
|
try {
|
|
96
117
|
return await open(filePath, "r");
|
|
@@ -180,9 +201,11 @@ export class AllureLocalHistory {
|
|
|
180
201
|
if (historyFile === undefined) {
|
|
181
202
|
return [];
|
|
182
203
|
}
|
|
204
|
+
const openedStreams = [];
|
|
183
205
|
try {
|
|
184
206
|
const start = await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, this.params.limit);
|
|
185
207
|
const stream = historyFile.createReadStream({ start, encoding: "utf-8", autoClose: false });
|
|
208
|
+
openedStreams.push(stream);
|
|
186
209
|
const historyPoints = [];
|
|
187
210
|
const readlineInterface = readline
|
|
188
211
|
.createInterface({ input: stream, terminal: false, crlfDelay: Infinity })
|
|
@@ -197,7 +220,8 @@ export class AllureLocalHistory {
|
|
|
197
220
|
return __classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f");
|
|
198
221
|
}
|
|
199
222
|
finally {
|
|
200
|
-
await
|
|
223
|
+
await __classPrivateFieldGet(this, _AllureLocalHistory_closeStreams, "f").call(this, openedStreams);
|
|
224
|
+
await closeFileHandle(historyFile);
|
|
201
225
|
}
|
|
202
226
|
}
|
|
203
227
|
async appendHistory(data) {
|
|
@@ -207,6 +231,7 @@ export class AllureLocalHistory {
|
|
|
207
231
|
const { limit } = this.params;
|
|
208
232
|
await mkdir(parentDir, { recursive: true });
|
|
209
233
|
const { file: historyFile, exists: historyExists } = await __classPrivateFieldGet(this, _AllureLocalHistory_ensureFileOpenedToAppend, "f").call(this, fullPath);
|
|
234
|
+
const openedStreams = [];
|
|
210
235
|
let dst;
|
|
211
236
|
try {
|
|
212
237
|
if (limit === 0) {
|
|
@@ -215,9 +240,11 @@ export class AllureLocalHistory {
|
|
|
215
240
|
return;
|
|
216
241
|
}
|
|
217
242
|
dst = historyFile.createWriteStream({ encoding: "utf-8", start: 0, autoClose: false });
|
|
243
|
+
openedStreams.push(dst);
|
|
218
244
|
if (historyExists) {
|
|
219
245
|
const start = await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, limit ? limit - 1 : undefined);
|
|
220
246
|
const src = historyFile.createReadStream({ start, autoClose: false });
|
|
247
|
+
openedStreams.push(src);
|
|
221
248
|
await pipeline(src, dst, { end: false });
|
|
222
249
|
}
|
|
223
250
|
const sources = [JSON.stringify(normalizedData), Buffer.from([0x0a])];
|
|
@@ -227,11 +254,8 @@ export class AllureLocalHistory {
|
|
|
227
254
|
}
|
|
228
255
|
}
|
|
229
256
|
finally {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
dst?.destroy();
|
|
233
|
-
}
|
|
234
|
-
await closing;
|
|
257
|
+
await __classPrivateFieldGet(this, _AllureLocalHistory_closeStreams, "f").call(this, openedStreams);
|
|
258
|
+
await closeFileHandle(historyFile);
|
|
235
259
|
if (limit !== 0) {
|
|
236
260
|
__classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").push(normalizedData);
|
|
237
261
|
}
|
|
@@ -241,4 +265,4 @@ export class AllureLocalHistory {
|
|
|
241
265
|
}
|
|
242
266
|
}
|
|
243
267
|
}
|
|
244
|
-
_AllureLocalHistory_cachedHistory = new WeakMap(), _AllureLocalHistory_openFileToReadIfExists = new WeakMap(), _AllureLocalHistory_ensureFileOpenedToAppend = new WeakMap(), _AllureLocalHistory_findFirstEntryAddress = new WeakMap(), _AllureLocalHistory_throwUnexpectedReadError = new WeakMap();
|
|
268
|
+
_AllureLocalHistory_cachedHistory = new WeakMap(), _AllureLocalHistory_closeStreams = new WeakMap(), _AllureLocalHistory_openFileToReadIfExists = new WeakMap(), _AllureLocalHistory_ensureFileOpenedToAppend = new WeakMap(), _AllureLocalHistory_findFirstEntryAddress = new WeakMap(), _AllureLocalHistory_throwUnexpectedReadError = new WeakMap();
|
package/dist/report.d.ts
CHANGED
|
@@ -8,12 +8,13 @@ export declare class AllureReport {
|
|
|
8
8
|
#private;
|
|
9
9
|
readonly reportUuid: string;
|
|
10
10
|
readonly reportName: string;
|
|
11
|
-
reportUrl?: string;
|
|
12
11
|
constructor(opts: FullConfig);
|
|
13
12
|
get hasQualityGate(): boolean;
|
|
14
13
|
get store(): DefaultAllureStore;
|
|
15
14
|
get realtimeSubscriber(): RealtimeSubscriber;
|
|
16
15
|
get realtimeDispatcher(): RealtimeEventsDispatcher;
|
|
16
|
+
get reportUrl(): string | undefined;
|
|
17
|
+
set reportUrl(url: string | undefined);
|
|
17
18
|
readDirectory: (resultsDir: string) => Promise<void>;
|
|
18
19
|
readFile: (resultsFile: string) => Promise<void>;
|
|
19
20
|
readResult: (data: ResultFile) => Promise<void>;
|
package/dist/report.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 _AllureReport_instances, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_realtimeChannel, _AllureReport_realtimeUpdateScheduler, _AllureReport_realTime, _AllureReport_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_historyBaseUrl, _AllureReport_appendHistory, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_globalAttachments, _AllureReport_knownIssuesPath, _AllureReport_dumpTempDirs, _AllureReport_cwd, _AllureReport_state, _AllureReport_executionStage, _AllureReport_historyDataPoint, _AllureReport_summaryPath, _AllureReport_testResultsRegistryPath, _AllureReport_summariesByPluginId, _AllureReport_publishedRemoteHrefs, _AllureReport_artifactFilesByPath, _AllureReport_published, _AllureReport_endGeneratePerfSpan,
|
|
12
|
+
var _AllureReport_instances, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_realtimeChannel, _AllureReport_realtimeUpdateScheduler, _AllureReport_realTime, _AllureReport_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_historyBaseUrl, _AllureReport_appendHistory, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_globalAttachments, _AllureReport_knownIssuesPath, _AllureReport_dumpTempDirs, _AllureReport_cwd, _AllureReport_state, _AllureReport_executionStage, _AllureReport_historyDataPoint, _AllureReport_summaryPath, _AllureReport_overviewHref, _AllureReport_testResultsRegistryPath, _AllureReport_summariesByPluginId, _AllureReport_publishedRemoteHrefs, _AllureReport_artifactFilesByPath, _AllureReport_published, _AllureReport_endGeneratePerfSpan, _AllureReport_resolvedReportUrl, _AllureReport_reportUrl, _AllureReport_resolveReportUrl, _AllureReport_createHistoryDataPoint, _AllureReport_ingestSelfPerfMetrics, _AllureReport_prepareReportFiles, _AllureReport_publish, _AllureReport_getCwd, _AllureReport_runRealtimeUpdate, _AllureReport_recordArtifact, _AllureReport_restoreStateDumps, _AllureReport_resolveOverviewHref, _AllureReport_getReportsToPublish, _AllureReport_cleanupFailedRemoteReport, _AllureReport_logPublishError, _AllureReport_applyPublishLinksToSummaries, _AllureReport_cloneSummariesByPluginId, _AllureReport_writeSummaryFiles, _AllureReport_writeTestResultRegistry, _AllureReport_getRootRemoteReportFiles, _AllureReport_writeQualityGateFiles, _AllureReport_finishArtifactsManifest, _AllureReport_generateRootSummary, _AllureReport_finishGeneratePerfSpan, _AllureReport_finishPerfMetrics, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
13
13
|
import console from "node:console";
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
15
|
import { once } from "node:events";
|
|
@@ -30,7 +30,7 @@ import { glob } from "glob";
|
|
|
30
30
|
import ZipReadStream from "node-stream-zip";
|
|
31
31
|
import pLimit from "p-limit";
|
|
32
32
|
import ZipWriteStream from "zip-stream";
|
|
33
|
-
import { AllureLocalHistory, createHistory, normalizeHistoryBaseUrl
|
|
33
|
+
import { AllureLocalHistory, createHistory, normalizeHistoryBaseUrl } from "./history.js";
|
|
34
34
|
import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
35
35
|
import { QualityGate } from "./qualityGate/index.js";
|
|
36
36
|
import { writeKnownIssues } from "./resolutions.js";
|
|
@@ -48,6 +48,7 @@ const MAX_READ_CONCURRENCY = 256;
|
|
|
48
48
|
const DEFAULT_UPLOAD_CONCURRENCY = 10;
|
|
49
49
|
const TEST_RESULTS_REGISTRY_FILENAME = "test-results.json";
|
|
50
50
|
const QUALITY_GATE_RESULTS_FILENAME = "quality-gate.json";
|
|
51
|
+
const AUXILIARY_OUTPUT_DIRECTORIES = new Set(["export"]);
|
|
51
52
|
const ROOT_INTEGRATION_FILENAMES = new Set([
|
|
52
53
|
TEST_RESULTS_REGISTRY_FILENAME,
|
|
53
54
|
QUALITY_GATE_RESULTS_FILENAME,
|
|
@@ -66,11 +67,15 @@ const readConcurrency = () => {
|
|
|
66
67
|
return Math.min(MAX_READ_CONCURRENCY, Math.max(1, parsed));
|
|
67
68
|
};
|
|
68
69
|
const clonePluginSummary = (summary) => structuredClone(summary);
|
|
69
|
-
const
|
|
70
|
+
const remoteBranchParams = (ci, branch) => {
|
|
70
71
|
const repo = ci?.repoName;
|
|
71
|
-
const branch = ci?.jobRunBranch;
|
|
72
72
|
return repo && branch ? { repo, branch } : {};
|
|
73
73
|
};
|
|
74
|
+
const remoteHistoryParams = (ci) => {
|
|
75
|
+
const historyBranch = ci?.targetBranch || ci?.jobRunBranch;
|
|
76
|
+
return remoteBranchParams(ci, historyBranch);
|
|
77
|
+
};
|
|
78
|
+
const remoteReportParams = (ci) => remoteBranchParams(ci, ci?.jobRunBranch);
|
|
74
79
|
const errorDetails = (err) => (err instanceof Error ? (err.stack ?? err.message) : String(err));
|
|
75
80
|
const getExecutorReportUrl = (executor) => {
|
|
76
81
|
if (!executor || typeof executor !== "object" || !("reportUrl" in executor)) {
|
|
@@ -126,28 +131,37 @@ export class AllureReport {
|
|
|
126
131
|
_AllureReport_executionStage.set(this, "init");
|
|
127
132
|
_AllureReport_historyDataPoint.set(this, void 0);
|
|
128
133
|
_AllureReport_summaryPath.set(this, void 0);
|
|
134
|
+
_AllureReport_overviewHref.set(this, void 0);
|
|
129
135
|
_AllureReport_testResultsRegistryPath.set(this, void 0);
|
|
130
136
|
_AllureReport_summariesByPluginId.set(this, new Map());
|
|
131
137
|
_AllureReport_publishedRemoteHrefs.set(this, new Set());
|
|
132
138
|
_AllureReport_artifactFilesByPath.set(this, new Map());
|
|
133
139
|
_AllureReport_published.set(this, false);
|
|
134
140
|
_AllureReport_endGeneratePerfSpan.set(this, void 0);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
_AllureReport_resolvedReportUrl.set(this, void 0);
|
|
142
|
+
_AllureReport_reportUrl.set(this, void 0);
|
|
143
|
+
_AllureReport_resolveReportUrl.set(this, async () => {
|
|
144
|
+
if (__classPrivateFieldGet(this, _AllureReport_reportUrl, "f"))
|
|
145
|
+
return;
|
|
146
|
+
if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
|
|
147
|
+
const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
|
|
148
|
+
historyUrl.pathname = `${historyUrl.pathname}index.html`;
|
|
149
|
+
__classPrivateFieldSet(this, _AllureReport_resolvedReportUrl, historyUrl.toString(), "f");
|
|
150
|
+
return;
|
|
138
151
|
}
|
|
139
152
|
const executorReportUrl = getExecutorReportUrl(await __classPrivateFieldGet(this, _AllureReport_store, "f").metadataByKey("allure2_executor"));
|
|
140
|
-
if (executorReportUrl)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
return "";
|
|
153
|
+
if (!executorReportUrl)
|
|
154
|
+
return;
|
|
155
|
+
__classPrivateFieldSet(this, _AllureReport_resolvedReportUrl, executorReportUrl, "f");
|
|
145
156
|
});
|
|
146
|
-
_AllureReport_createHistoryDataPoint.set(this, async () => {
|
|
147
|
-
const allTrs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults()
|
|
157
|
+
_AllureReport_createHistoryDataPoint.set(this, async (flattenReport) => {
|
|
158
|
+
const allTrs = await Promise.all((await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults()).map(async (tr) => ({
|
|
159
|
+
...tr,
|
|
160
|
+
retries: await __classPrivateFieldGet(this, _AllureReport_store, "f").retriesByTrId(tr.id),
|
|
161
|
+
})));
|
|
148
162
|
const allTcs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
149
|
-
const
|
|
150
|
-
return createHistory(this.reportUuid, this.reportName, allTcs, allTrs,
|
|
163
|
+
const historyUrl = __classPrivateFieldGet(this, _AllureReport_reportUrl, "f") ?? (!flattenReport && __classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f") ? __classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f") : __classPrivateFieldGet(this, _AllureReport_resolvedReportUrl, "f"));
|
|
164
|
+
return createHistory(this.reportUuid, this.reportName, allTcs, allTrs, historyUrl ?? "", await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics());
|
|
151
165
|
});
|
|
152
166
|
_AllureReport_ingestSelfPerfMetrics.set(this, async () => {
|
|
153
167
|
if (!isPerfMetricsEnabled()) {
|
|
@@ -163,6 +177,14 @@ export class AllureReport {
|
|
|
163
177
|
metadata: { originalFileName },
|
|
164
178
|
});
|
|
165
179
|
});
|
|
180
|
+
_AllureReport_prepareReportFiles.set(this, async () => {
|
|
181
|
+
await __classPrivateFieldGet(this, _AllureReport_writeTestResultRegistry, "f").call(this);
|
|
182
|
+
if (__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
|
|
183
|
+
await __classPrivateFieldGet(this, _AllureReport_writeQualityGateFiles, "f").call(this);
|
|
184
|
+
}
|
|
185
|
+
await __classPrivateFieldGet(this, _AllureReport_writeSummaryFiles, "f").call(this);
|
|
186
|
+
await __classPrivateFieldGet(this, _AllureReport_generateRootSummary, "f").call(this);
|
|
187
|
+
});
|
|
166
188
|
_AllureReport_publish.set(this, async () => {
|
|
167
189
|
if (__classPrivateFieldGet(this, _AllureReport_published, "f")) {
|
|
168
190
|
return;
|
|
@@ -170,17 +192,6 @@ export class AllureReport {
|
|
|
170
192
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "done") {
|
|
171
193
|
throw new Error("report is not completed. Call the done() method first.");
|
|
172
194
|
}
|
|
173
|
-
let historyPoint = __classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f");
|
|
174
|
-
if (!historyPoint) {
|
|
175
|
-
historyPoint = await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this);
|
|
176
|
-
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, historyPoint, "f");
|
|
177
|
-
}
|
|
178
|
-
await __classPrivateFieldGet(this, _AllureReport_writeTestResultRegistry, "f").call(this);
|
|
179
|
-
if (__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
|
|
180
|
-
await __classPrivateFieldGet(this, _AllureReport_writeQualityGateFiles, "f").call(this);
|
|
181
|
-
}
|
|
182
|
-
await __classPrivateFieldGet(this, _AllureReport_writeSummaryFiles, "f").call(this);
|
|
183
|
-
await __classPrivateFieldGet(this, _AllureReport_generateRootSummary, "f").call(this);
|
|
184
195
|
if (__classPrivateFieldGet(this, _AllureReport_realTime, "f") || !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
185
196
|
__classPrivateFieldSet(this, _AllureReport_published, true, "f");
|
|
186
197
|
return;
|
|
@@ -269,7 +280,7 @@ export class AllureReport {
|
|
|
269
280
|
publishErrorMessage = "Report completion has failed, the report won't be published";
|
|
270
281
|
await client.completeReport({
|
|
271
282
|
reportUuid: this.reportUuid,
|
|
272
|
-
historyPoint,
|
|
283
|
+
historyPoint: __classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"),
|
|
273
284
|
});
|
|
274
285
|
Object.values(linksByPluginId)
|
|
275
286
|
.filter(Boolean)
|
|
@@ -745,6 +756,19 @@ export class AllureReport {
|
|
|
745
756
|
}
|
|
746
757
|
return restoredCount;
|
|
747
758
|
}));
|
|
759
|
+
_AllureReport_resolveOverviewHref.set(this, async () => {
|
|
760
|
+
if (__classPrivateFieldGet(this, _AllureReport_realTime, "f")) {
|
|
761
|
+
return undefined;
|
|
762
|
+
}
|
|
763
|
+
let summariesCount = 0;
|
|
764
|
+
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
765
|
+
const summary = await plugin.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
766
|
+
if (summary) {
|
|
767
|
+
summariesCount += 1;
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
return summariesCount > 1 ? "../index.html" : undefined;
|
|
771
|
+
});
|
|
748
772
|
_AllureReport_getReportsToPublish.set(this, async () => {
|
|
749
773
|
const reports = [];
|
|
750
774
|
for (const { enabled, id, options } of __classPrivateFieldGet(this, _AllureReport_plugins, "f")) {
|
|
@@ -863,7 +887,8 @@ export class AllureReport {
|
|
|
863
887
|
await this.dumpState();
|
|
864
888
|
return;
|
|
865
889
|
}
|
|
866
|
-
await __classPrivateFieldGet(this,
|
|
890
|
+
await __classPrivateFieldGet(this, _AllureReport_resolveReportUrl, "f").call(this);
|
|
891
|
+
__classPrivateFieldSet(this, _AllureReport_overviewHref, await __classPrivateFieldGet(this, _AllureReport_resolveOverviewHref, "f").call(this), "f");
|
|
867
892
|
await measurePerf(PERF_METRIC_NAMES.generatePluginsDone, async () => {
|
|
868
893
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
869
894
|
await measurePerf(`${PERF_METRIC_PREFIXES.generatePluginDone}${context.id}`, async () => {
|
|
@@ -873,7 +898,6 @@ export class AllureReport {
|
|
|
873
898
|
});
|
|
874
899
|
__classPrivateFieldGet(this, _AllureReport_finishGeneratePerfSpan, "f").call(this);
|
|
875
900
|
await __classPrivateFieldGet(this, _AllureReport_ingestSelfPerfMetrics, "f").call(this);
|
|
876
|
-
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this), "f");
|
|
877
901
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
878
902
|
const summary = await plugin?.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
879
903
|
if (!summary) {
|
|
@@ -890,30 +914,26 @@ export class AllureReport {
|
|
|
890
914
|
__classPrivateFieldSet(this, _AllureReport_summariesByPluginId, new Map(summaries
|
|
891
915
|
.filter((summary) => !!summary.pluginId)
|
|
892
916
|
.map((summary) => [summary.pluginId, summary])), "f");
|
|
893
|
-
await __classPrivateFieldGet(this,
|
|
917
|
+
await __classPrivateFieldGet(this, _AllureReport_prepareReportFiles, "f").call(this);
|
|
894
918
|
let outputDirFiles = [];
|
|
895
919
|
try {
|
|
896
920
|
outputDirFiles = await readdir(__classPrivateFieldGet(this, _AllureReport_output, "f"));
|
|
897
921
|
}
|
|
898
922
|
catch { }
|
|
923
|
+
const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
|
|
924
|
+
const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
|
|
925
|
+
const reportDirectoryEntries = outputDirectoryEntries.filter(({ file }) => !AUXILIARY_OUTPUT_DIRECTORIES.has(file));
|
|
926
|
+
const shouldFlattenOutput = reportDirectoryEntries.length === 1 && __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ id }) => id === reportDirectoryEntries[0].file);
|
|
927
|
+
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this, shouldFlattenOutput), "f");
|
|
928
|
+
await __classPrivateFieldGet(this, _AllureReport_publish, "f").call(this);
|
|
899
929
|
if (__classPrivateFieldGet(this, _AllureReport_knownIssuesPath, "f")) {
|
|
900
930
|
await writeKnownIssues(__classPrivateFieldGet(this, _AllureReport_store, "f"), __classPrivateFieldGet(this, _AllureReport_knownIssuesPath, "f"));
|
|
901
931
|
}
|
|
902
932
|
if (outputDirFiles.length === 0) {
|
|
903
933
|
return;
|
|
904
934
|
}
|
|
905
|
-
const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
|
|
906
|
-
const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
|
|
907
|
-
const shouldFlattenOutput = outputDirectoryEntries.length === 1;
|
|
908
|
-
if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
|
|
909
|
-
const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
|
|
910
|
-
if (shouldFlattenOutput) {
|
|
911
|
-
historyUrl.pathname = `${historyUrl.pathname}index.html`;
|
|
912
|
-
}
|
|
913
|
-
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, setHistoryDataPointUrl(__classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"), historyUrl.toString()), "f");
|
|
914
|
-
}
|
|
915
935
|
if (shouldFlattenOutput) {
|
|
916
|
-
const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"),
|
|
936
|
+
const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"), reportDirectoryEntries[0].file);
|
|
917
937
|
const reportContent = await readdir(reportPath);
|
|
918
938
|
for (const entry of reportContent) {
|
|
919
939
|
if (ROOT_INTEGRATION_FILENAMES.has(entry)) {
|
|
@@ -1019,6 +1039,7 @@ export class AllureReport {
|
|
|
1019
1039
|
}
|
|
1020
1040
|
: {}),
|
|
1021
1041
|
reportUrl: this.reportUrl,
|
|
1042
|
+
overviewHref: __classPrivateFieldGet(this, _AllureReport_overviewHref, "f"),
|
|
1022
1043
|
realTime: !!__classPrivateFieldGet(this, _AllureReport_realTime, "f"),
|
|
1023
1044
|
output: __classPrivateFieldGet(this, _AllureReport_output, "f"),
|
|
1024
1045
|
ci: __classPrivateFieldGet(this, _AllureReport_ci, "f"),
|
|
@@ -1027,7 +1048,9 @@ export class AllureReport {
|
|
|
1027
1048
|
};
|
|
1028
1049
|
try {
|
|
1029
1050
|
await consumer.call(this, plugin, pluginContext);
|
|
1030
|
-
|
|
1051
|
+
if (pluginContext.reportUrl !== null && pluginContext.reportUrl !== this.reportUrl) {
|
|
1052
|
+
this.reportUrl = pluginContext.reportUrl;
|
|
1053
|
+
}
|
|
1031
1054
|
if (initState) {
|
|
1032
1055
|
__classPrivateFieldGet(this, _AllureReport_state, "f")[id] = pluginState;
|
|
1033
1056
|
}
|
|
@@ -1077,7 +1100,7 @@ export class AllureReport {
|
|
|
1077
1100
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
1078
1101
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
1079
1102
|
limit: historyLimit,
|
|
1080
|
-
...
|
|
1103
|
+
...remoteHistoryParams(__classPrivateFieldGet(this, _AllureReport_ci, "f")),
|
|
1081
1104
|
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
1082
1105
|
}), "f");
|
|
1083
1106
|
}
|
|
@@ -1117,7 +1140,13 @@ export class AllureReport {
|
|
|
1117
1140
|
get realtimeDispatcher() {
|
|
1118
1141
|
return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
|
|
1119
1142
|
}
|
|
1143
|
+
get reportUrl() {
|
|
1144
|
+
return __classPrivateFieldGet(this, _AllureReport_reportUrl, "f") ?? __classPrivateFieldGet(this, _AllureReport_resolvedReportUrl, "f");
|
|
1145
|
+
}
|
|
1146
|
+
set reportUrl(url) {
|
|
1147
|
+
__classPrivateFieldSet(this, _AllureReport_reportUrl, url, "f");
|
|
1148
|
+
}
|
|
1120
1149
|
}
|
|
1121
|
-
_AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_realtimeChannel = new WeakMap(), _AllureReport_realtimeUpdateScheduler = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_hideLabels = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_historyBaseUrl = new WeakMap(), _AllureReport_appendHistory = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_environments = new WeakMap(), _AllureReport_globalAttachments = new WeakMap(), _AllureReport_knownIssuesPath = new WeakMap(), _AllureReport_dumpTempDirs = new WeakMap(), _AllureReport_cwd = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_historyDataPoint = new WeakMap(), _AllureReport_summaryPath = new WeakMap(), _AllureReport_testResultsRegistryPath = new WeakMap(), _AllureReport_summariesByPluginId = new WeakMap(), _AllureReport_publishedRemoteHrefs = new WeakMap(), _AllureReport_artifactFilesByPath = new WeakMap(), _AllureReport_published = new WeakMap(), _AllureReport_endGeneratePerfSpan = new WeakMap(),
|
|
1150
|
+
_AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_realtimeChannel = new WeakMap(), _AllureReport_realtimeUpdateScheduler = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_hideLabels = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_historyBaseUrl = new WeakMap(), _AllureReport_appendHistory = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_environments = new WeakMap(), _AllureReport_globalAttachments = new WeakMap(), _AllureReport_knownIssuesPath = new WeakMap(), _AllureReport_dumpTempDirs = new WeakMap(), _AllureReport_cwd = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_historyDataPoint = new WeakMap(), _AllureReport_summaryPath = new WeakMap(), _AllureReport_overviewHref = new WeakMap(), _AllureReport_testResultsRegistryPath = new WeakMap(), _AllureReport_summariesByPluginId = new WeakMap(), _AllureReport_publishedRemoteHrefs = new WeakMap(), _AllureReport_artifactFilesByPath = new WeakMap(), _AllureReport_published = new WeakMap(), _AllureReport_endGeneratePerfSpan = new WeakMap(), _AllureReport_resolvedReportUrl = new WeakMap(), _AllureReport_reportUrl = new WeakMap(), _AllureReport_resolveReportUrl = new WeakMap(), _AllureReport_createHistoryDataPoint = new WeakMap(), _AllureReport_ingestSelfPerfMetrics = new WeakMap(), _AllureReport_prepareReportFiles = new WeakMap(), _AllureReport_publish = new WeakMap(), _AllureReport_getCwd = new WeakMap(), _AllureReport_runRealtimeUpdate = new WeakMap(), _AllureReport_recordArtifact = new WeakMap(), _AllureReport_restoreStateDumps = new WeakMap(), _AllureReport_resolveOverviewHref = new WeakMap(), _AllureReport_getReportsToPublish = new WeakMap(), _AllureReport_cleanupFailedRemoteReport = new WeakMap(), _AllureReport_logPublishError = new WeakMap(), _AllureReport_applyPublishLinksToSummaries = new WeakMap(), _AllureReport_cloneSummariesByPluginId = new WeakMap(), _AllureReport_writeSummaryFiles = new WeakMap(), _AllureReport_writeTestResultRegistry = new WeakMap(), _AllureReport_getRootRemoteReportFiles = new WeakMap(), _AllureReport_writeQualityGateFiles = new WeakMap(), _AllureReport_finishArtifactsManifest = new WeakMap(), _AllureReport_generateRootSummary = new WeakMap(), _AllureReport_finishGeneratePerfSpan = new WeakMap(), _AllureReport_finishPerfMetrics = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
1122
1151
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
|
1123
1152
|
};
|
package/dist/store/convert.js
CHANGED
|
@@ -36,7 +36,8 @@ export const testFixtureResultRawToState = (stateData, raw, context) => {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
export const testResultRawToState = (stateData, raw, context) => {
|
|
39
|
-
const
|
|
39
|
+
const testCaseHash = calculateTestCaseHash(raw.testId, raw.fullName);
|
|
40
|
+
const legacyTestCaseHash = calculateLegacyTestCaseHash(raw, testCaseHash);
|
|
40
41
|
const allureId = raw.labels
|
|
41
42
|
?.find((label) => (label?.name === "ALLURE_ID" || label?.name === "AS_ID") && label.value?.trim())
|
|
42
43
|
?.value?.trim();
|
|
@@ -45,9 +46,8 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
45
46
|
const threadId = findByLabelName(labels, "thread");
|
|
46
47
|
const name = raw.name || "Unknown test";
|
|
47
48
|
const parameters = convertParameters(raw.parameters);
|
|
48
|
-
const error = convertRawError(raw);
|
|
49
49
|
const errors = convertTestErrors(raw);
|
|
50
|
-
const
|
|
50
|
+
const error = errors?.[0] ?? convertRawError(raw);
|
|
51
51
|
const parametersHash = calculateParametersHash(parameters);
|
|
52
52
|
const testCase = processTestCase({ stateData, raw, allureId, testCaseHash });
|
|
53
53
|
return {
|
|
@@ -60,7 +60,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
60
60
|
environmentHash: null,
|
|
61
61
|
retryHash: calculateRetryHash({ testCaseHash, parametersHash }),
|
|
62
62
|
status: raw.status ?? defaultStatus,
|
|
63
|
-
error
|
|
63
|
+
error,
|
|
64
64
|
errors,
|
|
65
65
|
...processTimings(raw),
|
|
66
66
|
description: raw.description,
|
|
@@ -89,18 +89,12 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
89
89
|
titlePath: raw.titlePath ?? [],
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
|
-
const calculateLegacyTestCaseHash = (raw) => {
|
|
92
|
+
const calculateLegacyTestCaseHash = (raw, testCaseHash) => {
|
|
93
93
|
const maybeAllureId = raw.labels?.find((label) => (label?.name === "ALLURE_ID" || label?.name === "AS_ID") && label.value !== "-1")?.value;
|
|
94
94
|
if (maybeAllureId) {
|
|
95
95
|
return md5(`ALLURE_ID=${maybeAllureId}`);
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
return md5(raw.testId);
|
|
99
|
-
}
|
|
100
|
-
if (raw.fullName) {
|
|
101
|
-
return md5(raw.fullName);
|
|
102
|
-
}
|
|
103
|
-
return undefined;
|
|
97
|
+
return testCaseHash ?? undefined;
|
|
104
98
|
};
|
|
105
99
|
const processTestCase = ({ stateData: { testCases }, raw, allureId, testCaseHash, }) => {
|
|
106
100
|
if (testCaseHash) {
|
|
@@ -201,7 +195,16 @@ const processTimings = ({ start, stop, duration, }) => {
|
|
|
201
195
|
return { start: undefined, stop: undefined, duration };
|
|
202
196
|
};
|
|
203
197
|
const convertLabels = (labels) => {
|
|
204
|
-
|
|
198
|
+
const convertedLabels = [];
|
|
199
|
+
for (const label of labels ?? []) {
|
|
200
|
+
if (!notNull(label)) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
for (const expandedLabel of processTagLabels(convertLabel(label))) {
|
|
204
|
+
convertedLabels.push(normalizeAllureIdLabel(expandedLabel));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return convertedLabels;
|
|
205
208
|
};
|
|
206
209
|
const convertLabel = (label) => {
|
|
207
210
|
return {
|
|
@@ -210,16 +213,19 @@ const convertLabel = (label) => {
|
|
|
210
213
|
};
|
|
211
214
|
};
|
|
212
215
|
const convertSteps = (stateData, steps) => {
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
216
|
+
const convertedSteps = [];
|
|
217
|
+
const messages = new Set();
|
|
218
|
+
for (const step of steps ?? []) {
|
|
219
|
+
if (!notNull(step)) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const converted = convertStep(stateData, step);
|
|
223
|
+
convertedSteps.push(converted.convertedStep);
|
|
224
|
+
for (const message of converted.messages ?? []) {
|
|
225
|
+
messages.add(message);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return { convertedSteps, messages };
|
|
223
229
|
};
|
|
224
230
|
const convertStep = (stateData, step) => {
|
|
225
231
|
if (step.type === "step") {
|
|
@@ -251,10 +257,15 @@ const convertStep = (stateData, step) => {
|
|
|
251
257
|
},
|
|
252
258
|
};
|
|
253
259
|
};
|
|
254
|
-
const convertParameters = (parameters) =>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
const convertParameters = (parameters) => {
|
|
261
|
+
const convertedParameters = [];
|
|
262
|
+
for (const parameter of parameters ?? []) {
|
|
263
|
+
if (notNull(parameter) && typeof parameter.name === "string" && parameter.name.length > 0) {
|
|
264
|
+
convertedParameters.push(convertParameter(parameter));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return convertedParameters;
|
|
268
|
+
};
|
|
258
269
|
const convertParameter = (param) => ({
|
|
259
270
|
name: param.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
260
271
|
value: param.value ?? UNKNOWN_PARAMETER_VALUE,
|
|
@@ -262,10 +273,15 @@ const convertParameter = (param) => ({
|
|
|
262
273
|
excluded: param.excluded ?? false,
|
|
263
274
|
masked: param.masked ?? false,
|
|
264
275
|
});
|
|
265
|
-
const convertLinks = (links) =>
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
276
|
+
const convertLinks = (links) => {
|
|
277
|
+
const convertedLinks = [];
|
|
278
|
+
for (const link of links ?? []) {
|
|
279
|
+
if (notNull(link) && link.url) {
|
|
280
|
+
convertedLinks.push(convertLink(link));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return convertedLinks;
|
|
284
|
+
};
|
|
269
285
|
const convertLink = (link) => ({
|
|
270
286
|
name: link.name,
|
|
271
287
|
url: link.url ?? UNKNOWN_PARAMETER_VALUE,
|
|
@@ -41,7 +41,13 @@ export class RetrySubstore {
|
|
|
41
41
|
__classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").set(testResult.retryHash, [testResult]);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
results.
|
|
44
|
+
const existingIndex = results.findIndex((attempt) => attempt.id === testResult.id);
|
|
45
|
+
if (existingIndex !== -1) {
|
|
46
|
+
results.splice(existingIndex, 1, testResult);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
results.push(testResult);
|
|
50
|
+
}
|
|
45
51
|
results.sort((first, second) => __classPrivateFieldGet(this, _RetrySubstore_instances, "m", _RetrySubstore_compareResults).call(this, first, second));
|
|
46
52
|
results.forEach((attempt, index) => {
|
|
47
53
|
attempt.isRetry = index !== 0;
|
package/dist/store/store.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
82
82
|
attachmentsByTrId: Map<string, AttachmentLink[]>;
|
|
83
83
|
fixturesByTrId: Map<string, TestFixtureResult[]>;
|
|
84
84
|
historyByTrId: Map<string, HistoryTestResult[] | undefined>;
|
|
85
|
+
resolutionIssuesByTrId: Map<string, ResolutionIssue | undefined>;
|
|
85
86
|
retriesByTrId: Map<string, TestResult[]>;
|
|
86
87
|
}>;
|
|
87
88
|
failedTestResults(): Promise<TestResult[]>;
|
package/dist/store/store.js
CHANGED
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_detectFlaky, _DefaultAllureStore_resolutionsConfig, _DefaultAllureStore_resolutionIssues, _DefaultAllureStore_testResultIdsByResolutionIssueId, _DefaultAllureStore_resolutionIssueIdByTestResultId, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_allowedEnvironmentIds, _DefaultAllureStore_retrySubstore, _DefaultAllureStore_testResultIdsByEnvironmentId, _DefaultAllureStore_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_processGlobalAttachmentIds, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, _DefaultAllureStore_processGlobalErrors, _DefaultAllureStore_processGlobalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResultsById, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_metrics, _DefaultAllureStore_performance, _DefaultAllureStore_historyPoints, _DefaultAllureStore_historyLookup, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignIdentityHashes, _DefaultAllureStore_classifyResolution, _DefaultAllureStore_associateResolutionIssue, _DefaultAllureStore_removeResolutionIssueAssociation, _DefaultAllureStore_rebuildRetrySubstore, _DefaultAllureStore_rebuildIdentityIndexes, _DefaultAllureStore_rebuildEnvironmentIndexes, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_processGlobalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_resetProcessGlobals, _DefaultAllureStore_getHistoryLookup, _DefaultAllureStore_historyFor, _DefaultAllureStore_applyHistoryFlags, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps, _DefaultAllureStore_retriesByTr, _DefaultAllureStore_historyByTr;
|
|
13
13
|
import { extname } from "node:path";
|
|
14
|
-
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, calculateEnvironmentHash, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, compareBy, createDictionary, fallbackTestCaseIdLabelName, getWorstStatus, createHistoryTestResultLookup, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
14
|
+
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, calculateEnvironmentHash, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, compareBy, createDictionary, fallbackTestCaseIdLabelName, getWorstStatus, createHistoryTestResultLookup, hasRetriesStatusChange, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
15
15
|
import { md5, } from "@allurereport/plugin-api";
|
|
16
16
|
import { createResolutionIssue, getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
|
|
17
17
|
import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
|
|
@@ -22,10 +22,11 @@ import { testFixtureResultRawToState, testResultRawToState } from "./convert.js"
|
|
|
22
22
|
import { RetrySubstore } from "./retrySubstore.js";
|
|
23
23
|
const index = (indexMap, key, ...items) => {
|
|
24
24
|
if (key) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let current = indexMap.get(key);
|
|
26
|
+
if (!current) {
|
|
27
|
+
current = [];
|
|
28
|
+
indexMap.set(key, current);
|
|
27
29
|
}
|
|
28
|
-
const current = indexMap.get(key);
|
|
29
30
|
current.push(...items);
|
|
30
31
|
}
|
|
31
32
|
};
|
|
@@ -689,11 +690,14 @@ export class DefaultAllureStore {
|
|
|
689
690
|
const attachmentsByTrId = new Map();
|
|
690
691
|
const fixturesByTrId = new Map();
|
|
691
692
|
const historyByTrId = new Map();
|
|
693
|
+
const resolutionIssuesByTrId = new Map();
|
|
692
694
|
const retriesByTrId = new Map();
|
|
693
695
|
for (const trId of trIds) {
|
|
694
696
|
const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
|
|
697
|
+
const resolutionIssueId = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").get(trId);
|
|
695
698
|
attachmentsByTrId.set(trId, this.indexAttachmentByTestResult.get(trId) ?? []);
|
|
696
699
|
fixturesByTrId.set(trId, this.indexFixturesByTestResult.get(trId) ?? []);
|
|
700
|
+
resolutionIssuesByTrId.set(trId, resolutionIssueId ? __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").get(resolutionIssueId) : undefined);
|
|
697
701
|
retriesByTrId.set(trId, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr));
|
|
698
702
|
historyByTrId.set(trId, tr ? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyByTr).call(this, tr) : undefined);
|
|
699
703
|
}
|
|
@@ -701,6 +705,7 @@ export class DefaultAllureStore {
|
|
|
701
705
|
attachmentsByTrId,
|
|
702
706
|
fixturesByTrId,
|
|
703
707
|
historyByTrId,
|
|
708
|
+
resolutionIssuesByTrId,
|
|
704
709
|
retriesByTrId,
|
|
705
710
|
};
|
|
706
711
|
}
|
|
@@ -772,6 +777,9 @@ export class DefaultAllureStore {
|
|
|
772
777
|
if (retries.length > 0) {
|
|
773
778
|
statistic.retries = (statistic.retries ?? 0) + 1;
|
|
774
779
|
}
|
|
780
|
+
if (hasRetriesStatusChange(tr, retries)) {
|
|
781
|
+
statistic.retriesStatusChange = (statistic.retriesStatusChange ?? 0) + 1;
|
|
782
|
+
}
|
|
775
783
|
if (tr.flaky) {
|
|
776
784
|
statistic.flaky = (statistic.flaky ?? 0) + 1;
|
|
777
785
|
}
|
package/dist/utils/crypto.d.ts
CHANGED
package/dist/utils/crypto.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { randomBytes
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
export { md5 } from "@allurereport/plugin-api";
|
|
2
3
|
export const shortHash = () => randomBytes(8).toString("hex");
|
|
3
|
-
export const md5 = (data) => createHash("md5").update(data).digest("hex");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -21,42 +21,47 @@
|
|
|
21
21
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
22
22
|
"clean": "rimraf ./dist",
|
|
23
23
|
"test": "vitest run",
|
|
24
|
+
"test:unit": "yarn test",
|
|
24
25
|
"lint": "oxlint --import-plugin src test features stories",
|
|
25
26
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.
|
|
29
|
-
"@allurereport/cli-commons": "3.
|
|
30
|
-
"@allurereport/core-api": "3.
|
|
31
|
-
"@allurereport/plugin-agent": "3.
|
|
32
|
-
"@allurereport/plugin-allure2": "3.
|
|
33
|
-
"@allurereport/plugin-api": "3.
|
|
34
|
-
"@allurereport/plugin-awesome": "3.
|
|
35
|
-
"@allurereport/plugin-classic": "3.
|
|
36
|
-
"@allurereport/plugin-csv": "3.
|
|
37
|
-
"@allurereport/plugin-dashboard": "3.
|
|
38
|
-
"@allurereport/plugin-jira": "3.
|
|
39
|
-
"@allurereport/plugin-log": "3.
|
|
40
|
-
"@allurereport/plugin-
|
|
41
|
-
"@allurereport/plugin-
|
|
42
|
-
"@allurereport/plugin-
|
|
43
|
-
"@allurereport/plugin-
|
|
44
|
-
"@allurereport/
|
|
45
|
-
"@allurereport/
|
|
46
|
-
"@allurereport/
|
|
47
|
-
"@allurereport/
|
|
29
|
+
"@allurereport/ci": "3.21.0",
|
|
30
|
+
"@allurereport/cli-commons": "3.21.0",
|
|
31
|
+
"@allurereport/core-api": "3.21.0",
|
|
32
|
+
"@allurereport/plugin-agent": "3.21.0",
|
|
33
|
+
"@allurereport/plugin-allure2": "3.21.0",
|
|
34
|
+
"@allurereport/plugin-api": "3.21.0",
|
|
35
|
+
"@allurereport/plugin-awesome": "3.21.0",
|
|
36
|
+
"@allurereport/plugin-classic": "3.21.0",
|
|
37
|
+
"@allurereport/plugin-csv": "3.21.0",
|
|
38
|
+
"@allurereport/plugin-dashboard": "3.21.0",
|
|
39
|
+
"@allurereport/plugin-jira": "3.21.0",
|
|
40
|
+
"@allurereport/plugin-log": "3.21.0",
|
|
41
|
+
"@allurereport/plugin-metrics": "3.21.0",
|
|
42
|
+
"@allurereport/plugin-progress": "3.21.0",
|
|
43
|
+
"@allurereport/plugin-slack": "3.21.0",
|
|
44
|
+
"@allurereport/plugin-testops": "3.21.0",
|
|
45
|
+
"@allurereport/plugin-testplan": "3.21.0",
|
|
46
|
+
"@allurereport/plugin-xray": "3.21.0",
|
|
47
|
+
"@allurereport/reader": "3.21.0",
|
|
48
|
+
"@allurereport/reader-api": "3.21.0",
|
|
49
|
+
"@allurereport/service": "3.21.0",
|
|
50
|
+
"@allurereport/summary": "3.21.0",
|
|
48
51
|
"glob": "^13.0.6",
|
|
49
|
-
"handlebars": "
|
|
52
|
+
"handlebars": "4.7.10",
|
|
50
53
|
"jiti": "^2.5.1",
|
|
51
54
|
"node-stream-zip": "^1.15.0",
|
|
52
55
|
"p-limit": "^7.3.0",
|
|
53
|
-
"yaml": "^2.
|
|
56
|
+
"yaml": "^2.9.1",
|
|
54
57
|
"yoctocolors": "^2.2.0",
|
|
55
58
|
"zip-stream": "^7.0.5"
|
|
56
59
|
},
|
|
57
60
|
"devDependencies": {
|
|
61
|
+
"@allurereport/test-config": "3.21.0",
|
|
58
62
|
"@types/node": "^20",
|
|
59
63
|
"@types/zip-stream": "^7.0.0",
|
|
64
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
60
65
|
"@vitest/runner": "^2",
|
|
61
66
|
"@vitest/snapshot": "^5.0.1",
|
|
62
67
|
"allure-js-commons": "^3",
|