@allurereport/core 3.0.0-beta.18 → 3.0.0-beta.20
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 +2 -0
- package/dist/history.js +2 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/report.d.ts +3 -1
- package/dist/report.js +198 -16
- package/dist/store/store.d.ts +8 -3
- package/dist/store/store.js +284 -82
- package/package.json +21 -18
- package/dist/utils/stats.d.ts +0 -2
- package/dist/utils/stats.js +0 -22
package/dist/api.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface FullConfig {
|
|
|
13
13
|
historyPath: string;
|
|
14
14
|
knownIssuesPath: string;
|
|
15
15
|
defaultLabels?: DefaultLabelsConfig;
|
|
16
|
+
stage?: string;
|
|
17
|
+
environment?: string;
|
|
16
18
|
environments?: EnvironmentsConfig;
|
|
17
19
|
variables?: ReportVariables;
|
|
18
20
|
reportFiles: ReportFiles;
|
package/dist/history.js
CHANGED
|
@@ -16,15 +16,13 @@ const createHistoryItems = (testResults) => {
|
|
|
16
16
|
stop,
|
|
17
17
|
duration,
|
|
18
18
|
labels,
|
|
19
|
+
url: "",
|
|
19
20
|
historyId: historyId,
|
|
20
21
|
reportLinks: [],
|
|
21
22
|
};
|
|
22
23
|
})
|
|
23
24
|
.reduce((acc, item) => {
|
|
24
|
-
acc[item.historyId] =
|
|
25
|
-
...item,
|
|
26
|
-
url: "",
|
|
27
|
-
};
|
|
25
|
+
acc[item.historyId] = item;
|
|
28
26
|
return acc;
|
|
29
27
|
}, {});
|
|
30
28
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export type * from "./api.js";
|
|
|
2
2
|
export * from "./utils/misc.js";
|
|
3
3
|
export * from "./utils/crypto.js";
|
|
4
4
|
export * from "./utils/path.js";
|
|
5
|
-
export * from "./utils/stats.js";
|
|
6
5
|
export * from "./utils/git.js";
|
|
7
6
|
export * from "./utils/new.js";
|
|
8
7
|
export * from "./utils/flaky.js";
|
package/dist/index.js
CHANGED
package/dist/report.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KnownTestFailure, TestResult } from "@allurereport/core-api";
|
|
2
|
-
import type
|
|
2
|
+
import { type ResultFile } from "@allurereport/plugin-api";
|
|
3
3
|
import type { FullConfig } from "./api.js";
|
|
4
4
|
import { type QualityGateState } from "./qualityGate/index.js";
|
|
5
5
|
import { DefaultAllureStore } from "./store/store.js";
|
|
@@ -25,5 +25,7 @@ export declare class AllureReport {
|
|
|
25
25
|
results: import("@allurereport/plugin-api").QualityGateValidationResult[];
|
|
26
26
|
}>;
|
|
27
27
|
start: () => Promise<void>;
|
|
28
|
+
dumpState: () => Promise<void>;
|
|
29
|
+
restoreState: (stages: string[]) => Promise<void>;
|
|
28
30
|
done: () => Promise<void>;
|
|
29
31
|
}
|
package/dist/report.js
CHANGED
|
@@ -9,18 +9,23 @@ 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_reportName, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_eventEmitter, _AllureReport_realtimeSubscriber, _AllureReport_realtimeDispatcher, _AllureReport_realTime, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_state,
|
|
12
|
+
var _AllureReport_instances, _AllureReport_reportName, _AllureReport_reportVariables, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_eventEmitter, _AllureReport_realtimeSubscriber, _AllureReport_realtimeDispatcher, _AllureReport_realTime, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_stage, _AllureReport_stageTempDirs, _AllureReport_state, _AllureReport_executionStage, _AllureReport_publish_get, _AllureReport_update, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
13
13
|
import { detect } from "@allurereport/ci";
|
|
14
|
+
import { AllureStoreDumpFiles, } from "@allurereport/plugin-api";
|
|
14
15
|
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
15
16
|
import { PathResultFile } from "@allurereport/reader-api";
|
|
16
17
|
import { AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError } from "@allurereport/service";
|
|
17
18
|
import { generateSummary } from "@allurereport/summary";
|
|
19
|
+
import ZipReadStream from "node-stream-zip";
|
|
18
20
|
import console from "node:console";
|
|
19
21
|
import { randomUUID } from "node:crypto";
|
|
20
22
|
import { EventEmitter } from "node:events";
|
|
21
|
-
import { readFileSync } from "node:fs";
|
|
22
|
-
import { lstat, opendir, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
23
|
-
import {
|
|
23
|
+
import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
|
|
24
|
+
import { lstat, mkdtemp, opendir, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
25
|
+
import { tmpdir } from "node:os";
|
|
26
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
27
|
+
import { promisify } from "node:util";
|
|
28
|
+
import ZipWriteStream from "zip-stream";
|
|
24
29
|
import { AllureLocalHistory, createHistory } from "./history.js";
|
|
25
30
|
import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
26
31
|
import { QualityGate } from "./qualityGate/index.js";
|
|
@@ -32,6 +37,7 @@ export class AllureReport {
|
|
|
32
37
|
constructor(opts) {
|
|
33
38
|
_AllureReport_instances.add(this);
|
|
34
39
|
_AllureReport_reportName.set(this, void 0);
|
|
40
|
+
_AllureReport_reportVariables.set(this, void 0);
|
|
35
41
|
_AllureReport_ci.set(this, void 0);
|
|
36
42
|
_AllureReport_store.set(this, void 0);
|
|
37
43
|
_AllureReport_readers.set(this, void 0);
|
|
@@ -45,10 +51,12 @@ export class AllureReport {
|
|
|
45
51
|
_AllureReport_history.set(this, void 0);
|
|
46
52
|
_AllureReport_allureServiceClient.set(this, void 0);
|
|
47
53
|
_AllureReport_qualityGate.set(this, void 0);
|
|
54
|
+
_AllureReport_stage.set(this, void 0);
|
|
55
|
+
_AllureReport_stageTempDirs.set(this, []);
|
|
48
56
|
_AllureReport_state.set(this, void 0);
|
|
49
|
-
|
|
57
|
+
_AllureReport_executionStage.set(this, "init");
|
|
50
58
|
this.readDirectory = async (resultsDir) => {
|
|
51
|
-
if (__classPrivateFieldGet(this,
|
|
59
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
52
60
|
throw new Error(initRequired);
|
|
53
61
|
}
|
|
54
62
|
const resultsDirPath = resolve(resultsDir);
|
|
@@ -69,13 +77,13 @@ export class AllureReport {
|
|
|
69
77
|
}
|
|
70
78
|
};
|
|
71
79
|
this.readFile = async (resultsFile) => {
|
|
72
|
-
if (__classPrivateFieldGet(this,
|
|
80
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
73
81
|
throw new Error(initRequired);
|
|
74
82
|
}
|
|
75
83
|
await this.readResult(new PathResultFile(resultsFile));
|
|
76
84
|
};
|
|
77
85
|
this.readResult = async (data) => {
|
|
78
|
-
if (__classPrivateFieldGet(this,
|
|
86
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
79
87
|
throw new Error(initRequired);
|
|
80
88
|
}
|
|
81
89
|
for (const reader of __classPrivateFieldGet(this, _AllureReport_readers, "f")) {
|
|
@@ -98,13 +106,13 @@ export class AllureReport {
|
|
|
98
106
|
};
|
|
99
107
|
this.start = async () => {
|
|
100
108
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").readHistory();
|
|
101
|
-
if (__classPrivateFieldGet(this,
|
|
109
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "running") {
|
|
102
110
|
throw new Error("the report is already started");
|
|
103
111
|
}
|
|
104
|
-
if (__classPrivateFieldGet(this,
|
|
112
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "done") {
|
|
105
113
|
throw new Error("the report is already stopped, the restart isn't supported at the moment");
|
|
106
114
|
}
|
|
107
|
-
__classPrivateFieldSet(this,
|
|
115
|
+
__classPrivateFieldSet(this, _AllureReport_executionStage, "running", "f");
|
|
108
116
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
|
|
109
117
|
const { url } = await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").createReport({
|
|
110
118
|
reportUuid: this.reportUuid,
|
|
@@ -123,21 +131,186 @@ export class AllureReport {
|
|
|
123
131
|
}
|
|
124
132
|
};
|
|
125
133
|
_AllureReport_update.set(this, async () => {
|
|
126
|
-
if (__classPrivateFieldGet(this,
|
|
134
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
127
135
|
return;
|
|
128
136
|
}
|
|
129
137
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
130
138
|
await plugin.update?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
131
139
|
});
|
|
132
140
|
});
|
|
141
|
+
this.dumpState = async () => {
|
|
142
|
+
const { testResults, testCases, fixtures, attachments: attachmentsLinks, environments, globalAttachments = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, } = __classPrivateFieldGet(this, _AllureReport_store, "f").dumpState();
|
|
143
|
+
const allAttachments = await __classPrivateFieldGet(this, _AllureReport_store, "f").allAttachments();
|
|
144
|
+
const dumpArchive = new ZipWriteStream({
|
|
145
|
+
zlib: { level: 5 },
|
|
146
|
+
});
|
|
147
|
+
const addEntry = promisify(dumpArchive.entry.bind(dumpArchive));
|
|
148
|
+
const dumpArchiveWriteStream = createWriteStream(`${__classPrivateFieldGet(this, _AllureReport_stage, "f")}.zip`);
|
|
149
|
+
const promise = new Promise((res, rej) => {
|
|
150
|
+
dumpArchive.on("error", (err) => rej(err));
|
|
151
|
+
dumpArchiveWriteStream.on("finish", () => res(void 0));
|
|
152
|
+
dumpArchiveWriteStream.on("error", (err) => rej(err));
|
|
153
|
+
});
|
|
154
|
+
dumpArchive.pipe(dumpArchiveWriteStream);
|
|
155
|
+
await addEntry(Buffer.from(JSON.stringify(testResults)), {
|
|
156
|
+
name: AllureStoreDumpFiles.TestResults,
|
|
157
|
+
});
|
|
158
|
+
await addEntry(Buffer.from(JSON.stringify(testCases)), {
|
|
159
|
+
name: AllureStoreDumpFiles.TestCases,
|
|
160
|
+
});
|
|
161
|
+
await addEntry(Buffer.from(JSON.stringify(fixtures)), {
|
|
162
|
+
name: AllureStoreDumpFiles.Fixtures,
|
|
163
|
+
});
|
|
164
|
+
await addEntry(Buffer.from(JSON.stringify(attachmentsLinks)), {
|
|
165
|
+
name: AllureStoreDumpFiles.Attachments,
|
|
166
|
+
});
|
|
167
|
+
await addEntry(Buffer.from(JSON.stringify(environments)), {
|
|
168
|
+
name: AllureStoreDumpFiles.Environments,
|
|
169
|
+
});
|
|
170
|
+
await addEntry(Buffer.from(JSON.stringify(__classPrivateFieldGet(this, _AllureReport_reportVariables, "f"))), {
|
|
171
|
+
name: AllureStoreDumpFiles.ReportVariables,
|
|
172
|
+
});
|
|
173
|
+
await addEntry(Buffer.from(JSON.stringify(globalAttachments)), {
|
|
174
|
+
name: AllureStoreDumpFiles.GlobalAttachments,
|
|
175
|
+
});
|
|
176
|
+
await addEntry(Buffer.from(JSON.stringify(globalErrors)), {
|
|
177
|
+
name: AllureStoreDumpFiles.GlobalErrors,
|
|
178
|
+
});
|
|
179
|
+
await addEntry(Buffer.from(JSON.stringify(indexAttachmentByTestResult)), {
|
|
180
|
+
name: AllureStoreDumpFiles.IndexAttachmentsByTestResults,
|
|
181
|
+
});
|
|
182
|
+
await addEntry(Buffer.from(JSON.stringify(indexTestResultByHistoryId)), {
|
|
183
|
+
name: AllureStoreDumpFiles.IndexTestResultsByHistoryId,
|
|
184
|
+
});
|
|
185
|
+
await addEntry(Buffer.from(JSON.stringify(indexTestResultByTestCase)), {
|
|
186
|
+
name: AllureStoreDumpFiles.IndexTestResultsByTestCase,
|
|
187
|
+
});
|
|
188
|
+
await addEntry(Buffer.from(JSON.stringify(indexLatestEnvTestResultByHistoryId)), {
|
|
189
|
+
name: AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId,
|
|
190
|
+
});
|
|
191
|
+
await addEntry(Buffer.from(JSON.stringify(indexAttachmentByFixture)), {
|
|
192
|
+
name: AllureStoreDumpFiles.IndexAttachmentsByFixture,
|
|
193
|
+
});
|
|
194
|
+
await addEntry(Buffer.from(JSON.stringify(indexFixturesByTestResult)), {
|
|
195
|
+
name: AllureStoreDumpFiles.IndexFixturesByTestResult,
|
|
196
|
+
});
|
|
197
|
+
await addEntry(Buffer.from(JSON.stringify(indexKnownByHistoryId)), {
|
|
198
|
+
name: AllureStoreDumpFiles.IndexKnownByHistoryId,
|
|
199
|
+
});
|
|
200
|
+
for (const attachment of allAttachments) {
|
|
201
|
+
const content = await __classPrivateFieldGet(this, _AllureReport_store, "f").attachmentContentById(attachment.id);
|
|
202
|
+
if (!content) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (content instanceof PathResultFile) {
|
|
206
|
+
await addEntry(createReadStream(content.path), {
|
|
207
|
+
name: attachment.id,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
await addEntry(await content.asBuffer(), {
|
|
212
|
+
name: attachment.id,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
dumpArchive.finalize();
|
|
217
|
+
return promise;
|
|
218
|
+
};
|
|
219
|
+
this.restoreState = async (stages) => {
|
|
220
|
+
for (const stage of stages) {
|
|
221
|
+
if (!existsSync(stage)) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const dump = new ZipReadStream.async({
|
|
225
|
+
file: stage,
|
|
226
|
+
});
|
|
227
|
+
const testResultsEntry = await dump.entryData(AllureStoreDumpFiles.TestResults);
|
|
228
|
+
const testCasesEntry = await dump.entryData(AllureStoreDumpFiles.TestCases);
|
|
229
|
+
const fixturesEntry = await dump.entryData(AllureStoreDumpFiles.Fixtures);
|
|
230
|
+
const attachmentsEntry = await dump.entryData(AllureStoreDumpFiles.Attachments);
|
|
231
|
+
const environmentsEntry = await dump.entryData(AllureStoreDumpFiles.Environments);
|
|
232
|
+
const reportVariablesEntry = await dump.entryData(AllureStoreDumpFiles.ReportVariables);
|
|
233
|
+
const globalAttachmentsEntry = await dump.entryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
234
|
+
const globalErrorsEntry = await dump.entryData(AllureStoreDumpFiles.GlobalErrors);
|
|
235
|
+
const indexAttachmentsEntry = await dump.entryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
236
|
+
const indexTestResultsByHistoryId = await dump.entryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
237
|
+
const indexTestResultsByTestCaseEntry = await dump.entryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
238
|
+
const indexLatestEnvTestResultsByHistoryIdEntry = await dump.entryData(AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId);
|
|
239
|
+
const indexAttachmentsByFixtureEntry = await dump.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
240
|
+
const indexFixturesByTestResultEntry = await dump.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
241
|
+
const indexKnownByHistoryIdEntry = await dump.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
242
|
+
const attachmentsEntries = Object.entries(await dump.entries()).reduce((acc, [entryName, entry]) => {
|
|
243
|
+
switch (entryName) {
|
|
244
|
+
case AllureStoreDumpFiles.Attachments:
|
|
245
|
+
case AllureStoreDumpFiles.TestResults:
|
|
246
|
+
case AllureStoreDumpFiles.TestCases:
|
|
247
|
+
case AllureStoreDumpFiles.Fixtures:
|
|
248
|
+
case AllureStoreDumpFiles.Environments:
|
|
249
|
+
case AllureStoreDumpFiles.ReportVariables:
|
|
250
|
+
case AllureStoreDumpFiles.GlobalAttachments:
|
|
251
|
+
case AllureStoreDumpFiles.GlobalErrors:
|
|
252
|
+
case AllureStoreDumpFiles.IndexAttachmentsByTestResults:
|
|
253
|
+
case AllureStoreDumpFiles.IndexTestResultsByHistoryId:
|
|
254
|
+
case AllureStoreDumpFiles.IndexTestResultsByTestCase:
|
|
255
|
+
case AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId:
|
|
256
|
+
case AllureStoreDumpFiles.IndexAttachmentsByFixture:
|
|
257
|
+
case AllureStoreDumpFiles.IndexFixturesByTestResult:
|
|
258
|
+
case AllureStoreDumpFiles.IndexKnownByHistoryId:
|
|
259
|
+
return acc;
|
|
260
|
+
default:
|
|
261
|
+
return Object.assign(acc, {
|
|
262
|
+
[entryName]: entry,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}, {});
|
|
266
|
+
const dumpState = {
|
|
267
|
+
testResults: JSON.parse(testResultsEntry.toString("utf8")),
|
|
268
|
+
testCases: JSON.parse(testCasesEntry.toString("utf8")),
|
|
269
|
+
fixtures: JSON.parse(fixturesEntry.toString("utf8")),
|
|
270
|
+
attachments: JSON.parse(attachmentsEntry.toString("utf8")),
|
|
271
|
+
environments: JSON.parse(environmentsEntry.toString("utf8")),
|
|
272
|
+
reportVariables: JSON.parse(reportVariablesEntry.toString("utf8")),
|
|
273
|
+
globalAttachments: JSON.parse(globalAttachmentsEntry.toString("utf8")),
|
|
274
|
+
globalErrors: JSON.parse(globalErrorsEntry.toString("utf8")),
|
|
275
|
+
indexAttachmentByTestResult: JSON.parse(indexAttachmentsEntry.toString("utf8")),
|
|
276
|
+
indexTestResultByHistoryId: JSON.parse(indexTestResultsByHistoryId.toString("utf8")),
|
|
277
|
+
indexTestResultByTestCase: JSON.parse(indexTestResultsByTestCaseEntry.toString("utf8")),
|
|
278
|
+
indexLatestEnvTestResultByHistoryId: JSON.parse(indexLatestEnvTestResultsByHistoryIdEntry.toString("utf8")),
|
|
279
|
+
indexAttachmentByFixture: JSON.parse(indexAttachmentsByFixtureEntry.toString("utf8")),
|
|
280
|
+
indexFixturesByTestResult: JSON.parse(indexFixturesByTestResultEntry.toString("utf8")),
|
|
281
|
+
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
282
|
+
};
|
|
283
|
+
const stageTempDir = await mkdtemp(join(tmpdir(), basename(stage, ".zip")));
|
|
284
|
+
const resultsAttachments = {};
|
|
285
|
+
__classPrivateFieldGet(this, _AllureReport_stageTempDirs, "f").push(stageTempDir);
|
|
286
|
+
try {
|
|
287
|
+
for (const [attachmentId] of Object.entries(attachmentsEntries)) {
|
|
288
|
+
const attachmentContentEntry = await dump.entryData(attachmentId);
|
|
289
|
+
const attachmentFilePath = join(stageTempDir, attachmentId);
|
|
290
|
+
await writeFile(attachmentFilePath, attachmentContentEntry);
|
|
291
|
+
resultsAttachments[attachmentId] = new PathResultFile(attachmentFilePath, attachmentId);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
console.error(`Can't restore state from "${stage}", continuing without it`);
|
|
296
|
+
console.error(err);
|
|
297
|
+
}
|
|
298
|
+
await __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments);
|
|
299
|
+
console.info(`Successfully restored state from "${stage}"`);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
133
302
|
this.done = async () => {
|
|
134
303
|
const summaries = [];
|
|
135
304
|
const remoteHrefs = [];
|
|
136
|
-
if (__classPrivateFieldGet(this,
|
|
305
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
137
306
|
throw new Error(initRequired);
|
|
138
307
|
}
|
|
139
308
|
__classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f").offAll();
|
|
140
|
-
__classPrivateFieldSet(this,
|
|
309
|
+
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
310
|
+
if (__classPrivateFieldGet(this, _AllureReport_stage, "f")) {
|
|
311
|
+
await this.dumpState();
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
141
314
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
142
315
|
await plugin.done?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
143
316
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && context.publish) {
|
|
@@ -200,6 +373,12 @@ export class AllureReport {
|
|
|
200
373
|
}
|
|
201
374
|
await rm(reportPath, { recursive: true });
|
|
202
375
|
}
|
|
376
|
+
for (const dir of __classPrivateFieldGet(this, _AllureReport_stageTempDirs, "f")) {
|
|
377
|
+
try {
|
|
378
|
+
await rm(dir, { recursive: true });
|
|
379
|
+
}
|
|
380
|
+
catch (ignored) { }
|
|
381
|
+
}
|
|
203
382
|
if (__classPrivateFieldGet(this, _AllureReport_history, "f")) {
|
|
204
383
|
const testResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
205
384
|
const testCases = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
@@ -279,16 +458,18 @@ export class AllureReport {
|
|
|
279
458
|
}
|
|
280
459
|
}
|
|
281
460
|
});
|
|
282
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, defaultLabels = {}, variables = {}, environments, output, qualityGate, allureService: allureServiceConfig, } = opts;
|
|
461
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate, stage, allureService: allureServiceConfig, } = opts;
|
|
283
462
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.url ? new AllureServiceClient(allureServiceConfig) : undefined, "f");
|
|
284
463
|
this.reportUuid = randomUUID();
|
|
285
464
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
286
465
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
287
466
|
__classPrivateFieldSet(this, _AllureReport_reportName, [name, reportTitleSuffix].filter(Boolean).join(" – "), "f");
|
|
467
|
+
__classPrivateFieldSet(this, _AllureReport_reportVariables, variables, "f");
|
|
288
468
|
__classPrivateFieldSet(this, _AllureReport_eventEmitter, new EventEmitter(), "f");
|
|
289
469
|
__classPrivateFieldSet(this, _AllureReport_realtimeDispatcher, new RealtimeEventsDispatcher(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
290
470
|
__classPrivateFieldSet(this, _AllureReport_realtimeSubscriber, new RealtimeSubscriber(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
291
471
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
472
|
+
__classPrivateFieldSet(this, _AllureReport_stage, stage, "f");
|
|
292
473
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
293
474
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory(__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")), "f");
|
|
294
475
|
}
|
|
@@ -306,6 +487,7 @@ export class AllureReport {
|
|
|
306
487
|
history: __classPrivateFieldGet(this, _AllureReport_history, "f"),
|
|
307
488
|
known,
|
|
308
489
|
defaultLabels,
|
|
490
|
+
environment,
|
|
309
491
|
}), "f");
|
|
310
492
|
__classPrivateFieldSet(this, _AllureReport_readers, [...readers], "f");
|
|
311
493
|
__classPrivateFieldSet(this, _AllureReport_plugins, [...plugins], "f");
|
|
@@ -328,7 +510,7 @@ export class AllureReport {
|
|
|
328
510
|
return __classPrivateFieldGet(this, _AllureReport_realtimeDispatcher, "f");
|
|
329
511
|
}
|
|
330
512
|
}
|
|
331
|
-
_AllureReport_reportName = new WeakMap(), _AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_eventEmitter = new WeakMap(), _AllureReport_realtimeSubscriber = new WeakMap(), _AllureReport_realtimeDispatcher = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_state = new WeakMap(),
|
|
513
|
+
_AllureReport_reportName = new WeakMap(), _AllureReport_reportVariables = new WeakMap(), _AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_eventEmitter = new WeakMap(), _AllureReport_realtimeSubscriber = new WeakMap(), _AllureReport_realtimeDispatcher = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_stage = new WeakMap(), _AllureReport_stageTempDirs = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_update = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_publish_get = function _AllureReport_publish_get() {
|
|
332
514
|
return __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ enabled, options }) => enabled && options.publish);
|
|
333
515
|
}, _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
334
516
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type RepoData, type ReportVariables, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
|
-
import { type AllureStore, type ExitCode, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
1
|
+
import { type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type RepoData, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
|
+
import { type AllureStore, type AllureStoreDump, type ExitCode, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
3
3
|
import type { RawFixtureResult, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
4
|
+
export declare const mapToObject: <K extends string | number | symbol, T = any>(map: Map<K, T>) => Record<K, T>;
|
|
5
|
+
export declare const updateMapWithRecord: <K extends string | number | symbol, T = any>(map: Map<K, T>, record: Record<K, T>) => Map<K, T>;
|
|
4
6
|
export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
5
7
|
#private;
|
|
6
8
|
readonly indexTestResultByTestCase: Map<string, TestResult[]>;
|
|
@@ -16,6 +18,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
16
18
|
realtimeDispatcher?: RealtimeEventsDispatcher;
|
|
17
19
|
realtimeSubscriber?: RealtimeSubscriber;
|
|
18
20
|
defaultLabels?: DefaultLabelsConfig;
|
|
21
|
+
environment?: string;
|
|
19
22
|
environmentsConfig?: EnvironmentsConfig;
|
|
20
23
|
reportVariables?: ReportVariables;
|
|
21
24
|
});
|
|
@@ -61,7 +64,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
61
64
|
[x: string]: TestResult[];
|
|
62
65
|
_: TestResult[];
|
|
63
66
|
}>;
|
|
64
|
-
testsStatistic(filter?: TestResultFilter): Promise<
|
|
67
|
+
testsStatistic(filter?: TestResultFilter): Promise<Statistic>;
|
|
65
68
|
allEnvironments(): Promise<string[]>;
|
|
66
69
|
testResultsByEnvironment(env: string, options?: {
|
|
67
70
|
includeHidden: boolean;
|
|
@@ -71,4 +74,6 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
71
74
|
envVariables(env: string): Promise<{
|
|
72
75
|
[x: string]: string;
|
|
73
76
|
}>;
|
|
77
|
+
dumpState(): AllureStoreDump;
|
|
78
|
+
restoreState(stateDump: AllureStoreDump, attachmentsContents?: Record<string, ResultFile>): Promise<void>;
|
|
74
79
|
}
|
package/dist/store/store.js
CHANGED
|
@@ -9,13 +9,12 @@ 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 _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_globalAttachments, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_qualityGateResultsByRules, _DefaultAllureStore_historyPoints, _DefaultAllureStore_repoData;
|
|
13
|
-
import { compareBy, getWorstStatus, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
12
|
+
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_globalAttachments, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_qualityGateResultsByRules, _DefaultAllureStore_historyPoints, _DefaultAllureStore_repoData, _DefaultAllureStore_environments, _DefaultAllureStore_addEnvironments;
|
|
13
|
+
import { DEFAULT_ENVIRONMENT, compareBy, getWorstStatus, htrsByTr, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
14
|
import { md5, } from "@allurereport/plugin-api";
|
|
15
15
|
import { isFlaky } from "../utils/flaky.js";
|
|
16
16
|
import { getGitBranch, getGitRepoName } from "../utils/git.js";
|
|
17
17
|
import { getStatusTransition } from "../utils/new.js";
|
|
18
|
-
import { getTestResultsStats } from "../utils/stats.js";
|
|
19
18
|
import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
|
|
20
19
|
const index = (indexMap, key, ...items) => {
|
|
21
20
|
if (key) {
|
|
@@ -26,8 +25,47 @@ const index = (indexMap, key, ...items) => {
|
|
|
26
25
|
current.push(...items);
|
|
27
26
|
}
|
|
28
27
|
};
|
|
28
|
+
const wasStartedEarlier = (first, second) => first.start === undefined || second.start === undefined || first.start < second.start;
|
|
29
|
+
const hidePreviousAttempt = (state, testResult) => {
|
|
30
|
+
const { environment, historyId } = testResult;
|
|
31
|
+
if (environment) {
|
|
32
|
+
if (!state.has(environment)) {
|
|
33
|
+
state.set(environment, new Map());
|
|
34
|
+
}
|
|
35
|
+
if (historyId) {
|
|
36
|
+
const historyIdToLastAttemptResult = state.get(environment);
|
|
37
|
+
const currentLastAttemptResult = historyIdToLastAttemptResult.get(historyId);
|
|
38
|
+
if (currentLastAttemptResult) {
|
|
39
|
+
if (wasStartedEarlier(currentLastAttemptResult, testResult)) {
|
|
40
|
+
historyIdToLastAttemptResult.set(historyId, testResult);
|
|
41
|
+
currentLastAttemptResult.hidden = true;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
testResult.hidden = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
historyIdToLastAttemptResult.set(historyId, testResult);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const mapToObject = (map) => {
|
|
54
|
+
const result = {};
|
|
55
|
+
map.forEach((value, key) => {
|
|
56
|
+
result[key] = value;
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
export const updateMapWithRecord = (map, record) => {
|
|
61
|
+
Object.entries(record).forEach(([key, value]) => {
|
|
62
|
+
map.set(key, value);
|
|
63
|
+
});
|
|
64
|
+
return map;
|
|
65
|
+
};
|
|
29
66
|
export class DefaultAllureStore {
|
|
30
67
|
constructor(params) {
|
|
68
|
+
_DefaultAllureStore_instances.add(this);
|
|
31
69
|
_DefaultAllureStore_testResults.set(this, void 0);
|
|
32
70
|
_DefaultAllureStore_attachments.set(this, void 0);
|
|
33
71
|
_DefaultAllureStore_attachmentContents.set(this, void 0);
|
|
@@ -37,11 +75,13 @@ export class DefaultAllureStore {
|
|
|
37
75
|
_DefaultAllureStore_known.set(this, void 0);
|
|
38
76
|
_DefaultAllureStore_fixtures.set(this, void 0);
|
|
39
77
|
_DefaultAllureStore_defaultLabels.set(this, {});
|
|
78
|
+
_DefaultAllureStore_environment.set(this, void 0);
|
|
40
79
|
_DefaultAllureStore_environmentsConfig.set(this, {});
|
|
41
80
|
_DefaultAllureStore_reportVariables.set(this, {});
|
|
42
81
|
_DefaultAllureStore_realtimeDispatcher.set(this, void 0);
|
|
43
82
|
_DefaultAllureStore_realtimeSubscriber.set(this, void 0);
|
|
44
83
|
this.indexTestResultByTestCase = new Map();
|
|
84
|
+
this.indexLatestEnvTestResultByHistoryId = new Map();
|
|
45
85
|
this.indexTestResultByHistoryId = new Map();
|
|
46
86
|
this.indexAttachmentByTestResult = new Map();
|
|
47
87
|
this.indexAttachmentByFixture = new Map();
|
|
@@ -53,7 +93,11 @@ export class DefaultAllureStore {
|
|
|
53
93
|
_DefaultAllureStore_qualityGateResultsByRules.set(this, {});
|
|
54
94
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
55
95
|
_DefaultAllureStore_repoData.set(this, void 0);
|
|
56
|
-
|
|
96
|
+
_DefaultAllureStore_environments.set(this, []);
|
|
97
|
+
const { history, known = [], realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, environmentsConfig = {}, reportVariables = {}, } = params ?? {};
|
|
98
|
+
const environments = Object.keys(environmentsConfig)
|
|
99
|
+
.concat(environment ?? "")
|
|
100
|
+
.filter(Boolean);
|
|
57
101
|
__classPrivateFieldSet(this, _DefaultAllureStore_testResults, new Map(), "f");
|
|
58
102
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachments, new Map(), "f");
|
|
59
103
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachmentContents, new Map(), "f");
|
|
@@ -67,13 +111,9 @@ export class DefaultAllureStore {
|
|
|
67
111
|
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeSubscriber, realtimeSubscriber, "f");
|
|
68
112
|
__classPrivateFieldSet(this, _DefaultAllureStore_defaultLabels, defaultLabels, "f");
|
|
69
113
|
__classPrivateFieldSet(this, _DefaultAllureStore_environmentsConfig, environmentsConfig, "f");
|
|
114
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_environment, environment, "f");
|
|
70
115
|
__classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
|
|
71
|
-
this
|
|
72
|
-
Object.keys(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"))
|
|
73
|
-
.concat("default")
|
|
74
|
-
.forEach((key) => {
|
|
75
|
-
this.indexLatestEnvTestResultByHistoryId.set(key, new Map());
|
|
76
|
-
});
|
|
116
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
77
117
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults(async (results) => {
|
|
78
118
|
results.forEach((result) => {
|
|
79
119
|
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResultsByRules, "f")[result.rule] = result;
|
|
@@ -164,28 +204,12 @@ export class DefaultAllureStore {
|
|
|
164
204
|
}
|
|
165
205
|
});
|
|
166
206
|
}
|
|
167
|
-
testResult.environment = matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), testResult);
|
|
207
|
+
testResult.environment = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") || matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), testResult);
|
|
168
208
|
const trHistory = await this.historyByTr(testResult);
|
|
169
209
|
testResult.transition = getStatusTransition(testResult, trHistory);
|
|
170
210
|
testResult.flaky = isFlaky(testResult, trHistory);
|
|
171
211
|
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
172
|
-
|
|
173
|
-
const maybeOther = this.indexLatestEnvTestResultByHistoryId
|
|
174
|
-
.get(testResult.environment)
|
|
175
|
-
.get(testResult.historyId);
|
|
176
|
-
if (maybeOther) {
|
|
177
|
-
if (maybeOther.start === undefined || testResult.start === undefined || maybeOther.start < testResult.start) {
|
|
178
|
-
this.indexLatestEnvTestResultByHistoryId.get(testResult.environment).set(testResult.historyId, testResult);
|
|
179
|
-
maybeOther.hidden = true;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
testResult.hidden = true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
this.indexLatestEnvTestResultByHistoryId.get(testResult.environment).set(testResult.historyId, testResult);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
212
|
+
hidePreviousAttempt(this.indexLatestEnvTestResultByHistoryId, testResult);
|
|
189
213
|
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
190
214
|
index(this.indexTestResultByHistoryId, testResult.historyId, testResult);
|
|
191
215
|
index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
|
|
@@ -237,15 +261,28 @@ export class DefaultAllureStore {
|
|
|
237
261
|
}
|
|
238
262
|
async allTestResults(options = { includeHidden: false }) {
|
|
239
263
|
const { includeHidden } = options;
|
|
240
|
-
const result =
|
|
241
|
-
|
|
264
|
+
const result = [];
|
|
265
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
266
|
+
if (!includeHidden && tr.hidden) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
result.push(tr);
|
|
270
|
+
}
|
|
271
|
+
return result;
|
|
242
272
|
}
|
|
243
273
|
async allAttachments(options = {}) {
|
|
244
274
|
const { includeMissed = false, includeUnused = false } = options;
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
275
|
+
const filteredAttachments = [];
|
|
276
|
+
for (const [, attachment] of __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f")) {
|
|
277
|
+
if (!includeMissed && attachment.missed) {
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (!includeUnused && !attachment.used) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
filteredAttachments.push(attachment);
|
|
284
|
+
}
|
|
285
|
+
return filteredAttachments;
|
|
249
286
|
}
|
|
250
287
|
async allMetadata() {
|
|
251
288
|
const result = {};
|
|
@@ -262,14 +299,21 @@ export class DefaultAllureStore {
|
|
|
262
299
|
return __classPrivateFieldGet(this, _DefaultAllureStore_known, "f");
|
|
263
300
|
}
|
|
264
301
|
async allNewTestResults() {
|
|
265
|
-
const
|
|
302
|
+
const newTrs = [];
|
|
266
303
|
const allHistoryDps = await this.allHistoryDataPoints();
|
|
267
|
-
|
|
304
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
305
|
+
if (tr.hidden) {
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
268
308
|
if (!tr.historyId) {
|
|
269
|
-
|
|
309
|
+
newTrs.push(tr);
|
|
310
|
+
continue;
|
|
270
311
|
}
|
|
271
|
-
|
|
272
|
-
|
|
312
|
+
if (!allHistoryDps.some((dp) => dp.testResults[tr.historyId])) {
|
|
313
|
+
newTrs.push(tr);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return newTrs;
|
|
273
317
|
}
|
|
274
318
|
async testCaseById(tcId) {
|
|
275
319
|
return __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").get(tcId);
|
|
@@ -305,22 +349,7 @@ export class DefaultAllureStore {
|
|
|
305
349
|
return tr ? this.retriesByTr(tr) : [];
|
|
306
350
|
}
|
|
307
351
|
async historyByTr(tr) {
|
|
308
|
-
|
|
309
|
-
return [];
|
|
310
|
-
}
|
|
311
|
-
return [...__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f")]
|
|
312
|
-
.filter((dp) => !!dp.testResults[tr.historyId])
|
|
313
|
-
.map((dp) => {
|
|
314
|
-
if (!dp.url) {
|
|
315
|
-
return dp.testResults[tr.historyId];
|
|
316
|
-
}
|
|
317
|
-
const url = new URL(dp.url);
|
|
318
|
-
url.hash = tr.id;
|
|
319
|
-
return {
|
|
320
|
-
...dp.testResults[tr.historyId],
|
|
321
|
-
url: url.toString(),
|
|
322
|
-
};
|
|
323
|
-
});
|
|
352
|
+
return htrsByTr(__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f"), tr);
|
|
324
353
|
}
|
|
325
354
|
async historyByTrId(trId) {
|
|
326
355
|
const tr = await this.testResultById(trId);
|
|
@@ -330,8 +359,16 @@ export class DefaultAllureStore {
|
|
|
330
359
|
return this.indexFixturesByTestResult.get(trId) ?? [];
|
|
331
360
|
}
|
|
332
361
|
async failedTestResults() {
|
|
333
|
-
const
|
|
334
|
-
|
|
362
|
+
const failedTrs = [];
|
|
363
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
364
|
+
if (tr.hidden) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (tr.status === "failed" || tr.status === "broken") {
|
|
368
|
+
failedTrs.push(tr);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return failedTrs;
|
|
335
372
|
}
|
|
336
373
|
async unknownFailedTestResults() {
|
|
337
374
|
const failedTestResults = await this.failedTestResults();
|
|
@@ -345,12 +382,14 @@ export class DefaultAllureStore {
|
|
|
345
382
|
const results = {
|
|
346
383
|
_: [],
|
|
347
384
|
};
|
|
348
|
-
const
|
|
349
|
-
|
|
385
|
+
for (const [, test] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
386
|
+
if (test.hidden) {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
350
389
|
const targetLabels = (test.labels ?? []).filter((label) => label.name === labelName);
|
|
351
390
|
if (targetLabels.length === 0) {
|
|
352
391
|
results._.push(test);
|
|
353
|
-
|
|
392
|
+
continue;
|
|
354
393
|
}
|
|
355
394
|
targetLabels.forEach((label) => {
|
|
356
395
|
if (!results[label.value]) {
|
|
@@ -358,42 +397,65 @@ export class DefaultAllureStore {
|
|
|
358
397
|
}
|
|
359
398
|
results[label.value].push(test);
|
|
360
399
|
});
|
|
361
|
-
}
|
|
400
|
+
}
|
|
362
401
|
return results;
|
|
363
402
|
}
|
|
364
403
|
async testsStatistic(filter) {
|
|
365
|
-
const
|
|
366
|
-
const
|
|
404
|
+
const statistic = { total: 0 };
|
|
405
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
406
|
+
if (tr.hidden) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (filter && !filter(tr)) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
statistic.total++;
|
|
367
413
|
const retries = await this.retriesByTr(tr);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
414
|
+
if (retries.length > 0) {
|
|
415
|
+
statistic.retries = (statistic.retries ?? 0) + 1;
|
|
416
|
+
}
|
|
417
|
+
if (tr.flaky) {
|
|
418
|
+
statistic.flaky = (statistic.flaky ?? 0) + 1;
|
|
419
|
+
}
|
|
420
|
+
if (tr.transition === "new") {
|
|
421
|
+
statistic.new = (statistic.new ?? 0) + 1;
|
|
422
|
+
}
|
|
423
|
+
if (!statistic[tr.status]) {
|
|
424
|
+
statistic[tr.status] = 0;
|
|
425
|
+
}
|
|
426
|
+
statistic[tr.status]++;
|
|
427
|
+
}
|
|
428
|
+
return statistic;
|
|
374
429
|
}
|
|
375
430
|
async allEnvironments() {
|
|
376
|
-
return
|
|
431
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f");
|
|
377
432
|
}
|
|
378
433
|
async testResultsByEnvironment(env, options = { includeHidden: false }) {
|
|
379
|
-
const
|
|
380
|
-
|
|
434
|
+
const trs = [];
|
|
435
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
436
|
+
if (!options.includeHidden && tr.hidden) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (tr.environment === env) {
|
|
440
|
+
trs.push(tr);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return trs;
|
|
381
444
|
}
|
|
382
445
|
async allTestEnvGroups() {
|
|
383
|
-
const
|
|
384
|
-
const
|
|
446
|
+
const trByTestCaseId = {};
|
|
447
|
+
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
385
448
|
const testCaseId = tr?.testCase?.id;
|
|
386
449
|
if (!testCaseId) {
|
|
387
|
-
|
|
450
|
+
continue;
|
|
388
451
|
}
|
|
389
|
-
if (
|
|
390
|
-
|
|
452
|
+
if (trByTestCaseId[testCaseId]) {
|
|
453
|
+
trByTestCaseId[testCaseId].push(tr);
|
|
391
454
|
}
|
|
392
455
|
else {
|
|
393
|
-
|
|
456
|
+
trByTestCaseId[testCaseId] = [tr];
|
|
394
457
|
}
|
|
395
|
-
|
|
396
|
-
}, {});
|
|
458
|
+
}
|
|
397
459
|
return Object.entries(trByTestCaseId).reduce((acc, [testCaseId, trs]) => {
|
|
398
460
|
if (trs.length === 0) {
|
|
399
461
|
return acc;
|
|
@@ -407,7 +469,7 @@ export class DefaultAllureStore {
|
|
|
407
469
|
testResultsByEnv: {},
|
|
408
470
|
};
|
|
409
471
|
trs.forEach((tr) => {
|
|
410
|
-
const env = matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), tr);
|
|
472
|
+
const env = tr.environment || __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") || matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), tr);
|
|
411
473
|
envGroup.testResultsByEnv[env] = tr.id;
|
|
412
474
|
});
|
|
413
475
|
acc.push(envGroup);
|
|
@@ -423,5 +485,145 @@ export class DefaultAllureStore {
|
|
|
423
485
|
...(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")?.[env]?.variables ?? {}),
|
|
424
486
|
};
|
|
425
487
|
}
|
|
488
|
+
dumpState() {
|
|
489
|
+
const storeDump = {
|
|
490
|
+
testResults: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")),
|
|
491
|
+
attachments: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f")),
|
|
492
|
+
testCases: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f")),
|
|
493
|
+
fixtures: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f")),
|
|
494
|
+
environments: __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"),
|
|
495
|
+
reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
|
|
496
|
+
globalAttachments: __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f"),
|
|
497
|
+
globalErrors: __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"),
|
|
498
|
+
indexLatestEnvTestResultByHistoryId: {},
|
|
499
|
+
indexAttachmentByTestResult: {},
|
|
500
|
+
indexTestResultByHistoryId: {},
|
|
501
|
+
indexTestResultByTestCase: {},
|
|
502
|
+
indexAttachmentByFixture: {},
|
|
503
|
+
indexFixturesByTestResult: {},
|
|
504
|
+
indexKnownByHistoryId: {},
|
|
505
|
+
};
|
|
506
|
+
this.indexLatestEnvTestResultByHistoryId.forEach((envMap) => {
|
|
507
|
+
envMap.forEach((tr, historyId) => {
|
|
508
|
+
storeDump.indexLatestEnvTestResultByHistoryId[historyId] = tr.id;
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
this.indexAttachmentByFixture.forEach((link, fxId) => {
|
|
512
|
+
storeDump.indexAttachmentByFixture[fxId] = link.map((l) => l.id);
|
|
513
|
+
});
|
|
514
|
+
this.indexAttachmentByTestResult.forEach((links, trId) => {
|
|
515
|
+
storeDump.indexAttachmentByTestResult[trId] = links.map((l) => l.id);
|
|
516
|
+
});
|
|
517
|
+
this.indexTestResultByHistoryId.forEach((trs, historyId) => {
|
|
518
|
+
storeDump.indexTestResultByHistoryId[historyId] = trs.map((tr) => tr.id);
|
|
519
|
+
});
|
|
520
|
+
this.indexTestResultByTestCase.forEach((trs, tcId) => {
|
|
521
|
+
storeDump.indexTestResultByTestCase[tcId] = trs.map((tr) => tr.id);
|
|
522
|
+
});
|
|
523
|
+
this.indexFixturesByTestResult.forEach((fixtures, trId) => {
|
|
524
|
+
storeDump.indexFixturesByTestResult[trId] = fixtures.map((f) => f.id);
|
|
525
|
+
});
|
|
526
|
+
this.indexKnownByHistoryId.forEach((known, historyId) => {
|
|
527
|
+
storeDump.indexKnownByHistoryId[historyId] = known;
|
|
528
|
+
});
|
|
529
|
+
return storeDump;
|
|
530
|
+
}
|
|
531
|
+
async restoreState(stateDump, attachmentsContents = {}) {
|
|
532
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachments = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, } = stateDump;
|
|
533
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f"), testResults);
|
|
534
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
535
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
536
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
537
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f"), attachmentsContents);
|
|
538
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
539
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f").push(...globalAttachments);
|
|
540
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(...globalErrors);
|
|
541
|
+
Object.assign(__classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"), reportVariables);
|
|
542
|
+
Object.entries(indexAttachmentByTestResult).forEach(([trId, links]) => {
|
|
543
|
+
const attachmentsLinks = links.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
544
|
+
if (attachmentsLinks.length === 0) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const existingLinks = this.indexAttachmentByTestResult.get(trId);
|
|
548
|
+
if (!existingLinks) {
|
|
549
|
+
this.indexAttachmentByTestResult.set(trId, attachmentsLinks);
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
existingLinks.push(...attachmentsLinks);
|
|
553
|
+
});
|
|
554
|
+
Object.entries(indexTestResultByHistoryId).forEach(([historyId, trIds]) => {
|
|
555
|
+
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
556
|
+
if (trs.length === 0) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
const existingTrs = this.indexTestResultByHistoryId.get(historyId);
|
|
560
|
+
if (!existingTrs) {
|
|
561
|
+
this.indexTestResultByHistoryId.set(historyId, trs);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
existingTrs.push(...trs);
|
|
565
|
+
});
|
|
566
|
+
Object.entries(indexTestResultByTestCase).forEach(([tcId, trIds]) => {
|
|
567
|
+
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
568
|
+
if (trs.length === 0) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const existingTrs = this.indexTestResultByTestCase.get(tcId);
|
|
572
|
+
if (!existingTrs) {
|
|
573
|
+
this.indexTestResultByTestCase.set(tcId, trs);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
existingTrs.push(...trs);
|
|
577
|
+
});
|
|
578
|
+
Object.entries(indexAttachmentByFixture).forEach(([fxId, attachmentIds]) => {
|
|
579
|
+
const attachmentsLinks = attachmentIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
580
|
+
if (attachmentsLinks.length === 0) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const existingLinks = this.indexAttachmentByFixture.get(fxId);
|
|
584
|
+
if (!existingLinks) {
|
|
585
|
+
this.indexAttachmentByFixture.set(fxId, attachmentsLinks);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
existingLinks.push(...attachmentsLinks);
|
|
589
|
+
});
|
|
590
|
+
Object.entries(indexFixturesByTestResult).forEach(([trId, fixtureIds]) => {
|
|
591
|
+
const fxs = fixtureIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").get(id)).filter(Boolean);
|
|
592
|
+
if (fxs.length === 0) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const existingFixtures = this.indexFixturesByTestResult.get(trId);
|
|
596
|
+
if (!existingFixtures) {
|
|
597
|
+
this.indexFixturesByTestResult.set(trId, fxs);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
existingFixtures.push(...fxs);
|
|
601
|
+
});
|
|
602
|
+
Object.entries(indexKnownByHistoryId).forEach(([historyId, knownFailures]) => {
|
|
603
|
+
const existingKnown = this.indexKnownByHistoryId.get(historyId);
|
|
604
|
+
if (!existingKnown) {
|
|
605
|
+
this.indexKnownByHistoryId.set(historyId, knownFailures);
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
existingKnown.push(...knownFailures);
|
|
609
|
+
});
|
|
610
|
+
Object.values(indexLatestEnvTestResultByHistoryId).forEach((trId) => {
|
|
611
|
+
const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
|
|
612
|
+
if (!tr) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
hidePreviousAttempt(this.indexLatestEnvTestResultByHistoryId, tr);
|
|
616
|
+
});
|
|
617
|
+
}
|
|
426
618
|
}
|
|
427
|
-
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_known = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_globalAttachments = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_qualityGateResultsByRules = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_repoData = new WeakMap()
|
|
619
|
+
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_known = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environment = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_globalAttachments = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_qualityGateResultsByRules = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_repoData = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_addEnvironments = function _DefaultAllureStore_addEnvironments(envs) {
|
|
620
|
+
if (__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").length === 0) {
|
|
621
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").push(DEFAULT_ENVIRONMENT);
|
|
622
|
+
}
|
|
623
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_environments, Array.from(new Set([...__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"), ...envs])), "f");
|
|
624
|
+
envs.forEach((key) => {
|
|
625
|
+
if (!this.indexLatestEnvTestResultByHistoryId.has(key)) {
|
|
626
|
+
this.indexLatestEnvTestResultByHistoryId.set(key, new Map());
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,25 +25,27 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.0.0-beta.
|
|
29
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
30
|
-
"@allurereport/plugin-allure2": "3.0.0-beta.
|
|
31
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
32
|
-
"@allurereport/plugin-awesome": "3.0.0-beta.
|
|
33
|
-
"@allurereport/plugin-classic": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-csv": "3.0.0-beta.
|
|
35
|
-
"@allurereport/plugin-dashboard": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-log": "3.0.0-beta.
|
|
37
|
-
"@allurereport/plugin-progress": "3.0.0-beta.
|
|
38
|
-
"@allurereport/plugin-slack": "3.0.0-beta.
|
|
39
|
-
"@allurereport/plugin-testplan": "3.0.0-beta.
|
|
40
|
-
"@allurereport/reader": "3.0.0-beta.
|
|
41
|
-
"@allurereport/reader-api": "3.0.0-beta.
|
|
42
|
-
"@allurereport/service": "3.0.0-beta.
|
|
43
|
-
"@allurereport/summary": "3.0.0-beta.
|
|
28
|
+
"@allurereport/ci": "3.0.0-beta.20",
|
|
29
|
+
"@allurereport/core-api": "3.0.0-beta.20",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.0.0-beta.20",
|
|
31
|
+
"@allurereport/plugin-api": "3.0.0-beta.20",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.20",
|
|
33
|
+
"@allurereport/plugin-classic": "3.0.0-beta.20",
|
|
34
|
+
"@allurereport/plugin-csv": "3.0.0-beta.20",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.0.0-beta.20",
|
|
36
|
+
"@allurereport/plugin-log": "3.0.0-beta.20",
|
|
37
|
+
"@allurereport/plugin-progress": "3.0.0-beta.20",
|
|
38
|
+
"@allurereport/plugin-slack": "3.0.0-beta.20",
|
|
39
|
+
"@allurereport/plugin-testplan": "3.0.0-beta.20",
|
|
40
|
+
"@allurereport/reader": "3.0.0-beta.20",
|
|
41
|
+
"@allurereport/reader-api": "3.0.0-beta.20",
|
|
42
|
+
"@allurereport/service": "3.0.0-beta.20",
|
|
43
|
+
"@allurereport/summary": "3.0.0-beta.20",
|
|
44
44
|
"handlebars": "^4.7.8",
|
|
45
45
|
"markdown-it": "^14.1.0",
|
|
46
|
-
"
|
|
46
|
+
"node-stream-zip": "^1.15.0",
|
|
47
|
+
"yoctocolors": "^2.1.1",
|
|
48
|
+
"zip-stream": "^7.0.2"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@stylistic/eslint-plugin": "^2.6.1",
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
"@types/handlebars": "^4.1.0",
|
|
52
54
|
"@types/markdown-it": "^14.1.2",
|
|
53
55
|
"@types/node": "^20.17.9",
|
|
56
|
+
"@types/zip-stream": "^7.0.0",
|
|
54
57
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
55
58
|
"@typescript-eslint/parser": "^8.0.0",
|
|
56
59
|
"@vitest/runner": "^2.1.9",
|
package/dist/utils/stats.d.ts
DELETED
package/dist/utils/stats.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const getTestResultsStats = (trs, filter = () => true) => {
|
|
2
|
-
const trsToProcess = trs.filter(filter);
|
|
3
|
-
return trsToProcess.reduce((acc, tr) => {
|
|
4
|
-
if (filter && !filter(tr)) {
|
|
5
|
-
return acc;
|
|
6
|
-
}
|
|
7
|
-
if (tr.retries && tr.retries?.length > 0) {
|
|
8
|
-
acc.retries = (acc.retries ?? 0) + 1;
|
|
9
|
-
}
|
|
10
|
-
if (tr.flaky) {
|
|
11
|
-
acc.flaky = (acc.flaky ?? 0) + 1;
|
|
12
|
-
}
|
|
13
|
-
if (tr.transition === "new") {
|
|
14
|
-
acc.new = (acc.new ?? 0) + 1;
|
|
15
|
-
}
|
|
16
|
-
if (!acc[tr.status]) {
|
|
17
|
-
acc[tr.status] = 0;
|
|
18
|
-
}
|
|
19
|
-
acc[tr.status]++;
|
|
20
|
-
return acc;
|
|
21
|
-
}, { total: trsToProcess.length });
|
|
22
|
-
};
|