@allurereport/core 3.1.0 → 3.2.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/history.d.ts +1 -1
- package/dist/history.js +120 -30
- package/dist/qualityGate/qualityGate.d.ts +2 -1
- package/dist/qualityGate/qualityGate.js +3 -1
- package/dist/report.d.ts +1 -0
- package/dist/report.js +11 -10
- package/dist/store/convert.js +3 -5
- package/dist/store/store.d.ts +8 -5
- package/dist/store/store.js +74 -24
- package/dist/utils/event.d.ts +9 -3
- package/dist/utils/event.js +2 -2
- package/package.json +19 -21
package/dist/history.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AllureHistory, HistoryDataPoint, TestCase, TestResult } from "@allurereport/core-api";
|
|
2
2
|
export declare const createHistory: (reportUuid: string, reportName: string | undefined, testCases: TestCase[], testResults: TestResult[], remoteUrl?: string) => HistoryDataPoint;
|
|
3
|
-
export declare const writeHistory: (historyPath: string, data: HistoryDataPoint) => Promise<void>;
|
|
4
3
|
export declare class AllureLocalHistory implements AllureHistory {
|
|
4
|
+
#private;
|
|
5
5
|
private readonly params;
|
|
6
6
|
constructor(params: {
|
|
7
7
|
historyPath: string;
|
package/dist/history.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _AllureLocalHistory_openFileToReadIfExists, _AllureLocalHistory_ensureFileOpenedToAppend, _AllureLocalHistory_findFirstEntryAddress, _AllureLocalHistory_throwUnexpectedReadError;
|
|
7
|
+
import { once } from "node:events";
|
|
8
|
+
import { mkdir, open } from "node:fs/promises";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import readline from "node:readline/promises";
|
|
11
|
+
import { pipeline } from "node:stream/promises";
|
|
3
12
|
import { isFileNotFoundError } from "./utils/misc.js";
|
|
4
13
|
const createHistoryItems = (testResults) => {
|
|
5
14
|
return testResults
|
|
@@ -39,46 +48,127 @@ export const createHistory = (reportUuid, reportName = "Allure Report", testCase
|
|
|
39
48
|
url: remoteUrl,
|
|
40
49
|
};
|
|
41
50
|
};
|
|
42
|
-
export const writeHistory = async (historyPath, data) => {
|
|
43
|
-
const path = resolve(historyPath);
|
|
44
|
-
const parentDir = dirname(path);
|
|
45
|
-
await mkdir(parentDir, { recursive: true });
|
|
46
|
-
await writeFile(path, `${JSON.stringify(data)}\n`, { encoding: "utf-8", flag: "a+" });
|
|
47
|
-
};
|
|
48
51
|
export class AllureLocalHistory {
|
|
49
52
|
constructor(params) {
|
|
50
53
|
this.params = params;
|
|
54
|
+
_AllureLocalHistory_openFileToReadIfExists.set(this, async (filePath) => {
|
|
55
|
+
try {
|
|
56
|
+
return await open(filePath, "r");
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (isFileNotFoundError(e)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
_AllureLocalHistory_ensureFileOpenedToAppend.set(this, async (filePath) => {
|
|
66
|
+
try {
|
|
67
|
+
return {
|
|
68
|
+
file: await open(filePath, "r+"),
|
|
69
|
+
exists: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
if (isFileNotFoundError(e)) {
|
|
74
|
+
return {
|
|
75
|
+
file: await open(filePath, "w"),
|
|
76
|
+
exists: false,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
_AllureLocalHistory_findFirstEntryAddress.set(this, async (jsonlFile, limit) => {
|
|
83
|
+
if (limit === undefined) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
if (limit < 0) {
|
|
87
|
+
throw new Error(`Invalid history limit ${limit}. A history limit must be a positive integer number`);
|
|
88
|
+
}
|
|
89
|
+
const stat = await jsonlFile.stat();
|
|
90
|
+
let { size: position } = stat;
|
|
91
|
+
const { mtimeMs: originalMtime } = stat;
|
|
92
|
+
if (position === 0 || limit === 0) {
|
|
93
|
+
return position;
|
|
94
|
+
}
|
|
95
|
+
const buffer = Buffer.alloc(Buffer.poolSize);
|
|
96
|
+
while (position) {
|
|
97
|
+
const bytesToRead = Math.min(position, buffer.byteLength);
|
|
98
|
+
position -= bytesToRead;
|
|
99
|
+
const { bytesRead } = await jsonlFile.read({ buffer, length: bytesToRead, position });
|
|
100
|
+
if (bytesRead !== bytesToRead) {
|
|
101
|
+
__classPrivateFieldGet(this, _AllureLocalHistory_throwUnexpectedReadError, "f").call(this, jsonlFile, originalMtime, bytesToRead, bytesRead);
|
|
102
|
+
}
|
|
103
|
+
for (let i = bytesToRead - 1; i >= 0; i--) {
|
|
104
|
+
if (buffer[i] === 0x0a) {
|
|
105
|
+
if (limit-- === 0) {
|
|
106
|
+
return position + i + 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return 0;
|
|
112
|
+
});
|
|
113
|
+
_AllureLocalHistory_throwUnexpectedReadError.set(this, async (file, mtime, expectedBytes, actualBytes) => {
|
|
114
|
+
const { mtimeMs: currentMtime } = await file.stat();
|
|
115
|
+
if (currentMtime !== mtime) {
|
|
116
|
+
throw new Error("The history file was modified outside Allure. " +
|
|
117
|
+
"Please, make sure the file doesn't change while Allure is running");
|
|
118
|
+
}
|
|
119
|
+
throw new Error(`Can't read the history file: the expected number of bytes to read ${expectedBytes} ` +
|
|
120
|
+
`doesn't match the actual number ${actualBytes}`);
|
|
121
|
+
});
|
|
51
122
|
}
|
|
52
123
|
async readHistory() {
|
|
53
|
-
const
|
|
124
|
+
const fullPath = path.resolve(this.params.historyPath);
|
|
125
|
+
const historyFile = await __classPrivateFieldGet(this, _AllureLocalHistory_openFileToReadIfExists, "f").call(this, fullPath);
|
|
126
|
+
if (historyFile === undefined) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
54
129
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
130
|
+
const start = await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, this.params.limit);
|
|
131
|
+
const stream = historyFile.createReadStream({ start, encoding: "utf-8", autoClose: false });
|
|
132
|
+
const historyPoints = [];
|
|
133
|
+
const readlineInterface = readline
|
|
134
|
+
.createInterface({ input: stream, terminal: false, crlfDelay: Infinity })
|
|
135
|
+
.on("line", (line) => {
|
|
136
|
+
if (line && line.trim().length) {
|
|
137
|
+
const historyEntry = JSON.parse(line);
|
|
138
|
+
historyPoints.push(historyEntry);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
await once(readlineInterface, "close");
|
|
62
142
|
return historyPoints;
|
|
63
143
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
throw e;
|
|
144
|
+
finally {
|
|
145
|
+
await historyFile.close();
|
|
69
146
|
}
|
|
70
147
|
}
|
|
71
148
|
async appendHistory(data) {
|
|
72
|
-
const
|
|
73
|
-
const parentDir = dirname(
|
|
149
|
+
const fullPath = path.resolve(this.params.historyPath);
|
|
150
|
+
const parentDir = path.dirname(fullPath);
|
|
151
|
+
const { limit } = this.params;
|
|
74
152
|
await mkdir(parentDir, { recursive: true });
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
153
|
+
const { file: historyFile, exists: historyExists } = await __classPrivateFieldGet(this, _AllureLocalHistory_ensureFileOpenedToAppend, "f").call(this, fullPath);
|
|
154
|
+
try {
|
|
155
|
+
const dst = historyFile.createWriteStream({ encoding: "utf-8", start: 0, autoClose: false });
|
|
156
|
+
if (limit !== 0) {
|
|
157
|
+
if (historyExists) {
|
|
158
|
+
const start = limit ? await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, limit - 1) : 0;
|
|
159
|
+
const src = historyFile.createReadStream({ start, autoClose: false });
|
|
160
|
+
await pipeline(src, dst, { end: false });
|
|
161
|
+
}
|
|
162
|
+
const sources = [JSON.stringify(data), Buffer.from([0x0a])];
|
|
163
|
+
await pipeline(sources, dst);
|
|
164
|
+
}
|
|
165
|
+
if (historyExists) {
|
|
166
|
+
await historyFile.truncate(dst.bytesWritten);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
await historyFile.close();
|
|
78
171
|
}
|
|
79
|
-
const existingHistory = await this.readHistory();
|
|
80
|
-
const updatedHistory = [...existingHistory, data].slice(-this.params.limit);
|
|
81
|
-
const fileContent = updatedHistory.reduce((acc, point) => `${acc}${JSON.stringify(point)}\n`, "");
|
|
82
|
-
await writeFile(path, fileContent, "utf-8");
|
|
83
172
|
}
|
|
84
173
|
}
|
|
174
|
+
_AllureLocalHistory_openFileToReadIfExists = new WeakMap(), _AllureLocalHistory_ensureFileOpenedToAppend = new WeakMap(), _AllureLocalHistory_findFirstEntryAddress = new WeakMap(), _AllureLocalHistory_throwUnexpectedReadError = new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type KnownTestFailure, type TestError, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { QualityGateConfig, QualityGateValidationResult } from "@allurereport/plugin-api";
|
|
3
3
|
export declare const stringifyQualityGateResults: (results: QualityGateValidationResult[]) => string;
|
|
4
4
|
export declare const convertQualityGateResultsToTestErrors: (results: QualityGateValidationResult[]) => TestError[];
|
|
@@ -14,6 +14,7 @@ export declare class QualityGate {
|
|
|
14
14
|
state?: QualityGateState;
|
|
15
15
|
trs: TestResult[];
|
|
16
16
|
knownIssues: KnownTestFailure[];
|
|
17
|
+
environment?: string;
|
|
17
18
|
}): Promise<{
|
|
18
19
|
fastFailed: boolean;
|
|
19
20
|
results: QualityGateValidationResult[];
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _QualityGateState_state;
|
|
7
|
+
import { DEFAULT_ENVIRONMENT } from "@allurereport/core-api";
|
|
7
8
|
import { gray, red } from "yoctocolors";
|
|
8
9
|
import { qualityGateDefaultRules } from "./rules.js";
|
|
9
10
|
export const stringifyQualityGateResults = (results) => {
|
|
@@ -44,7 +45,7 @@ export class QualityGate {
|
|
|
44
45
|
this.config = config;
|
|
45
46
|
}
|
|
46
47
|
async validate(payload) {
|
|
47
|
-
const { state, trs, knownIssues } = payload;
|
|
48
|
+
const { state, trs, knownIssues, environment } = payload;
|
|
48
49
|
const { rules, use = [...qualityGateDefaultRules] } = this.config;
|
|
49
50
|
const results = [];
|
|
50
51
|
let fastFailed = false;
|
|
@@ -88,6 +89,7 @@ export class QualityGate {
|
|
|
88
89
|
actual: result.actual,
|
|
89
90
|
expected,
|
|
90
91
|
}),
|
|
92
|
+
environment: environment || DEFAULT_ENVIRONMENT,
|
|
91
93
|
});
|
|
92
94
|
if (ruleset.fastFail) {
|
|
93
95
|
fastFailed = true;
|
package/dist/report.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class AllureReport {
|
|
|
20
20
|
trs: TestResult[];
|
|
21
21
|
knownIssues: KnownTestFailure[];
|
|
22
22
|
state?: QualityGateState;
|
|
23
|
+
environment?: string;
|
|
23
24
|
}) => Promise<{
|
|
24
25
|
fastFailed: boolean;
|
|
25
26
|
results: import("@allurereport/plugin-api").QualityGateValidationResult[];
|
package/dist/report.js
CHANGED
|
@@ -99,11 +99,12 @@ export class AllureReport {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
this.validate = async (params) => {
|
|
102
|
-
const { trs, knownIssues, state } = params;
|
|
102
|
+
const { trs, knownIssues, state, environment } = params;
|
|
103
103
|
return __classPrivateFieldGet(this, _AllureReport_qualityGate, "f").validate({
|
|
104
104
|
trs: trs.filter(Boolean),
|
|
105
105
|
knownIssues,
|
|
106
106
|
state,
|
|
107
|
+
environment,
|
|
107
108
|
});
|
|
108
109
|
};
|
|
109
110
|
this.start = async () => {
|
|
@@ -143,7 +144,7 @@ export class AllureReport {
|
|
|
143
144
|
});
|
|
144
145
|
});
|
|
145
146
|
this.dumpState = async () => {
|
|
146
|
-
const { testResults, testCases, fixtures, attachments: attachmentsLinks, environments,
|
|
147
|
+
const { testResults, testCases, fixtures, attachments: attachmentsLinks, environments, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = __classPrivateFieldGet(this, _AllureReport_store, "f").dumpState();
|
|
147
148
|
const allAttachments = await __classPrivateFieldGet(this, _AllureReport_store, "f").allAttachments();
|
|
148
149
|
const dumpArchive = new ZipWriteStream({
|
|
149
150
|
zlib: { level: 5 },
|
|
@@ -174,7 +175,7 @@ export class AllureReport {
|
|
|
174
175
|
await addEntry(Buffer.from(JSON.stringify(__classPrivateFieldGet(this, _AllureReport_reportVariables, "f"))), {
|
|
175
176
|
name: AllureStoreDumpFiles.ReportVariables,
|
|
176
177
|
});
|
|
177
|
-
await addEntry(Buffer.from(JSON.stringify(
|
|
178
|
+
await addEntry(Buffer.from(JSON.stringify(globalAttachmentIds)), {
|
|
178
179
|
name: AllureStoreDumpFiles.GlobalAttachments,
|
|
179
180
|
});
|
|
180
181
|
await addEntry(Buffer.from(JSON.stringify(globalErrors)), {
|
|
@@ -201,8 +202,8 @@ export class AllureReport {
|
|
|
201
202
|
await addEntry(Buffer.from(JSON.stringify(indexKnownByHistoryId)), {
|
|
202
203
|
name: AllureStoreDumpFiles.IndexKnownByHistoryId,
|
|
203
204
|
});
|
|
204
|
-
await addEntry(Buffer.from(JSON.stringify(
|
|
205
|
-
name: AllureStoreDumpFiles.
|
|
205
|
+
await addEntry(Buffer.from(JSON.stringify(qualityGateResults)), {
|
|
206
|
+
name: AllureStoreDumpFiles.QualityGateResults,
|
|
206
207
|
});
|
|
207
208
|
for (const attachment of allAttachments) {
|
|
208
209
|
const content = await __classPrivateFieldGet(this, _AllureReport_store, "f").attachmentContentById(attachment.id);
|
|
@@ -246,7 +247,7 @@ export class AllureReport {
|
|
|
246
247
|
const indexAttachmentsByFixtureEntry = await dump.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
247
248
|
const indexFixturesByTestResultEntry = await dump.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
248
249
|
const indexKnownByHistoryIdEntry = await dump.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
249
|
-
const
|
|
250
|
+
const qualityGateResultsEntry = await dump.entryData(AllureStoreDumpFiles.QualityGateResults);
|
|
250
251
|
const attachmentsEntries = Object.entries(await dump.entries()).reduce((acc, [entryName, entry]) => {
|
|
251
252
|
switch (entryName) {
|
|
252
253
|
case AllureStoreDumpFiles.Attachments:
|
|
@@ -264,7 +265,7 @@ export class AllureReport {
|
|
|
264
265
|
case AllureStoreDumpFiles.IndexAttachmentsByFixture:
|
|
265
266
|
case AllureStoreDumpFiles.IndexFixturesByTestResult:
|
|
266
267
|
case AllureStoreDumpFiles.IndexKnownByHistoryId:
|
|
267
|
-
case AllureStoreDumpFiles.
|
|
268
|
+
case AllureStoreDumpFiles.QualityGateResults:
|
|
268
269
|
return acc;
|
|
269
270
|
default:
|
|
270
271
|
return Object.assign(acc, {
|
|
@@ -279,7 +280,7 @@ export class AllureReport {
|
|
|
279
280
|
attachments: JSON.parse(attachmentsEntry.toString("utf8")),
|
|
280
281
|
environments: JSON.parse(environmentsEntry.toString("utf8")),
|
|
281
282
|
reportVariables: JSON.parse(reportVariablesEntry.toString("utf8")),
|
|
282
|
-
|
|
283
|
+
globalAttachmentIds: JSON.parse(globalAttachmentsEntry.toString("utf8")),
|
|
283
284
|
globalErrors: JSON.parse(globalErrorsEntry.toString("utf8")),
|
|
284
285
|
indexAttachmentByTestResult: JSON.parse(indexAttachmentsEntry.toString("utf8")),
|
|
285
286
|
indexTestResultByHistoryId: JSON.parse(indexTestResultsByHistoryId.toString("utf8")),
|
|
@@ -288,7 +289,7 @@ export class AllureReport {
|
|
|
288
289
|
indexAttachmentByFixture: JSON.parse(indexAttachmentsByFixtureEntry.toString("utf8")),
|
|
289
290
|
indexFixturesByTestResult: JSON.parse(indexFixturesByTestResultEntry.toString("utf8")),
|
|
290
291
|
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
291
|
-
|
|
292
|
+
qualityGateResults: JSON.parse(qualityGateResultsEntry.toString("utf8")),
|
|
292
293
|
};
|
|
293
294
|
const stageTempDir = await mkdtemp(join(tmpdir(), basename(stage, ".zip")));
|
|
294
295
|
const resultsAttachments = {};
|
|
@@ -460,7 +461,7 @@ export class AllureReport {
|
|
|
460
461
|
if (!__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
|
|
461
462
|
return;
|
|
462
463
|
}
|
|
463
|
-
const qualityGateResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").
|
|
464
|
+
const qualityGateResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").qualityGateResultsByEnv();
|
|
464
465
|
await writeFile(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), "quality-gate.json"), JSON.stringify(qualityGateResults));
|
|
465
466
|
};
|
|
466
467
|
_AllureReport_eachPlugin.set(this, async (initState, consumer) => {
|
package/dist/store/convert.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { findByLabelName, notNull } from "@allurereport/core-api";
|
|
2
2
|
import { md5 } from "@allurereport/plugin-api";
|
|
3
3
|
import { extension, lookupContentType } from "@allurereport/reader-api";
|
|
4
|
-
import MarkdownIt from "markdown-it";
|
|
5
4
|
import { randomUUID } from "node:crypto";
|
|
6
5
|
const defaultStatus = "unknown";
|
|
7
6
|
export const __unknown = "#___unknown_value___#";
|
|
@@ -47,11 +46,11 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
47
46
|
},
|
|
48
47
|
...processTimings(raw),
|
|
49
48
|
description: raw.description,
|
|
50
|
-
descriptionHtml: raw.descriptionHtml
|
|
49
|
+
descriptionHtml: raw.descriptionHtml,
|
|
51
50
|
precondition: raw.precondition,
|
|
52
|
-
preconditionHtml: raw.preconditionHtml
|
|
51
|
+
preconditionHtml: raw.preconditionHtml,
|
|
53
52
|
expectedResult: raw.expectedResult,
|
|
54
|
-
expectedResultHtml: raw.expectedResultHtml
|
|
53
|
+
expectedResultHtml: raw.expectedResultHtml,
|
|
55
54
|
flaky: raw.flaky ?? false,
|
|
56
55
|
muted: raw.muted ?? false,
|
|
57
56
|
known: raw.known ?? false,
|
|
@@ -235,7 +234,6 @@ const convertLink = (link) => ({
|
|
|
235
234
|
url: link.url ?? __unknown,
|
|
236
235
|
type: link.type,
|
|
237
236
|
});
|
|
238
|
-
const markdownToHtml = (value) => (value ? new MarkdownIt().render(value) : undefined);
|
|
239
237
|
const calculateTestId = (raw) => {
|
|
240
238
|
const maybeAllureId = raw.labels?.find((label) => label.name === "ALLURE_ID" || label.name === "AS_ID")?.value;
|
|
241
239
|
if (maybeAllureId) {
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
1
|
+
import { type AllureHistory, type AttachmentLink, type AttachmentLinkLinked, type DefaultLabelsConfig, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
import { type AllureStore, type AllureStoreDump, type ExitCode, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
3
|
-
import type { RawFixtureResult, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
3
|
+
import type { RawFixtureResult, RawGlobals, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
4
4
|
export declare const mapToObject: <K extends string | number | symbol, T = any>(map: Map<K, T>) => Record<K, T>;
|
|
5
5
|
export declare const updateMapWithRecord: <K extends string | number | symbol, T = any>(map: Map<K, T>, record: Record<K, T>) => Map<K, T>;
|
|
6
6
|
export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
@@ -25,16 +25,19 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
25
25
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
26
26
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
27
27
|
qualityGateResults(): Promise<QualityGateValidationResult[]>;
|
|
28
|
+
qualityGateResultsByEnv(): Promise<Record<string, QualityGateValidationResult[]>>;
|
|
28
29
|
globalExitCode(): Promise<ExitCode | undefined>;
|
|
29
30
|
allGlobalErrors(): Promise<TestError[]>;
|
|
30
|
-
allGlobalAttachments(): Promise<
|
|
31
|
+
allGlobalAttachments(): Promise<AttachmentLinkLinked[]>;
|
|
31
32
|
visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
|
|
32
33
|
visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
|
|
33
|
-
visitAttachmentFile(resultFile: ResultFile
|
|
34
|
+
visitAttachmentFile(resultFile: ResultFile): Promise<void>;
|
|
34
35
|
visitMetadata(metadata: RawMetadata): Promise<void>;
|
|
36
|
+
visitGlobals(globals: RawGlobals): Promise<void>;
|
|
35
37
|
allTestCases(): Promise<TestCase[]>;
|
|
36
38
|
allTestResults(options?: {
|
|
37
39
|
includeHidden?: boolean;
|
|
40
|
+
filter?: TestResultFilter;
|
|
38
41
|
}): Promise<TestResult[]>;
|
|
39
42
|
allAttachments(options?: {
|
|
40
43
|
includeMissed?: boolean;
|
|
@@ -45,7 +48,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
45
48
|
allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
|
|
46
49
|
allHistoryDataPointsByEnvironment(environment: string): Promise<HistoryDataPoint[]>;
|
|
47
50
|
allKnownIssues(): Promise<KnownTestFailure[]>;
|
|
48
|
-
allNewTestResults(): Promise<TestResult[]>;
|
|
51
|
+
allNewTestResults(filter?: TestResultFilter): Promise<TestResult[]>;
|
|
49
52
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
50
53
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
|
51
54
|
attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
|
package/dist/store/store.js
CHANGED
|
@@ -9,9 +9,10 @@ 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_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,
|
|
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_globalAttachmentIds, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_addEnvironments;
|
|
13
13
|
import { DEFAULT_ENVIRONMENT, compareBy, getWorstStatus, htrsByTr, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
14
|
import { md5, } from "@allurereport/plugin-api";
|
|
15
|
+
import { extname } from "node:path";
|
|
15
16
|
import { isFlaky } from "../utils/flaky.js";
|
|
16
17
|
import { getStatusTransition } from "../utils/new.js";
|
|
17
18
|
import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
|
|
@@ -86,10 +87,10 @@ export class DefaultAllureStore {
|
|
|
86
87
|
this.indexAttachmentByFixture = new Map();
|
|
87
88
|
this.indexFixturesByTestResult = new Map();
|
|
88
89
|
this.indexKnownByHistoryId = new Map();
|
|
89
|
-
|
|
90
|
+
_DefaultAllureStore_globalAttachmentIds.set(this, []);
|
|
90
91
|
_DefaultAllureStore_globalErrors.set(this, []);
|
|
91
92
|
_DefaultAllureStore_globalExitCode.set(this, void 0);
|
|
92
|
-
|
|
93
|
+
_DefaultAllureStore_qualityGateResults.set(this, []);
|
|
93
94
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
94
95
|
_DefaultAllureStore_environments.set(this, []);
|
|
95
96
|
const { history, known = [], realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, environmentsConfig = {}, reportVariables = {}, } = params ?? {};
|
|
@@ -113,9 +114,7 @@ export class DefaultAllureStore {
|
|
|
113
114
|
__classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
|
|
114
115
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
115
116
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults(async (results) => {
|
|
116
|
-
|
|
117
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResultsByRules, "f")[result.rule] = result;
|
|
118
|
-
});
|
|
117
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(...results);
|
|
119
118
|
});
|
|
120
119
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalExitCode(async (exitCode) => {
|
|
121
120
|
__classPrivateFieldSet(this, _DefaultAllureStore_globalExitCode, exitCode, "f");
|
|
@@ -123,18 +122,21 @@ export class DefaultAllureStore {
|
|
|
123
122
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalError(async (error) => {
|
|
124
123
|
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(error);
|
|
125
124
|
});
|
|
126
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalAttachment(async (attachment) => {
|
|
125
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalAttachment(async ({ attachment, fileName }) => {
|
|
126
|
+
const originalFileName = attachment.getOriginalFileName();
|
|
127
127
|
const attachmentLink = {
|
|
128
|
-
id: md5(
|
|
128
|
+
id: md5(originalFileName),
|
|
129
|
+
name: fileName || originalFileName,
|
|
129
130
|
missed: false,
|
|
130
|
-
used:
|
|
131
|
+
used: true,
|
|
131
132
|
ext: attachment.getExtension(),
|
|
132
|
-
originalFileName: attachment.getOriginalFileName(),
|
|
133
133
|
contentType: attachment.getContentType(),
|
|
134
134
|
contentLength: attachment.getContentLength(),
|
|
135
|
+
originalFileName,
|
|
135
136
|
};
|
|
137
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").set(attachmentLink.id, attachmentLink);
|
|
136
138
|
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(attachmentLink.id, attachment);
|
|
137
|
-
__classPrivateFieldGet(this,
|
|
139
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").push(attachmentLink.id);
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
async readHistory() {
|
|
@@ -153,7 +155,18 @@ export class DefaultAllureStore {
|
|
|
153
155
|
await __classPrivateFieldGet(this, _DefaultAllureStore_history, "f").appendHistory(history);
|
|
154
156
|
}
|
|
155
157
|
async qualityGateResults() {
|
|
156
|
-
return
|
|
158
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f");
|
|
159
|
+
}
|
|
160
|
+
async qualityGateResultsByEnv() {
|
|
161
|
+
const resultsByEnv = {};
|
|
162
|
+
for (const result of __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f")) {
|
|
163
|
+
const environment = result.environment || "default";
|
|
164
|
+
if (!resultsByEnv[environment]) {
|
|
165
|
+
resultsByEnv[environment] = [];
|
|
166
|
+
}
|
|
167
|
+
resultsByEnv[environment].push(result);
|
|
168
|
+
}
|
|
169
|
+
return resultsByEnv;
|
|
157
170
|
}
|
|
158
171
|
async globalExitCode() {
|
|
159
172
|
return __classPrivateFieldGet(this, _DefaultAllureStore_globalExitCode, "f");
|
|
@@ -162,7 +175,14 @@ export class DefaultAllureStore {
|
|
|
162
175
|
return __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f");
|
|
163
176
|
}
|
|
164
177
|
async allGlobalAttachments() {
|
|
165
|
-
return __classPrivateFieldGet(this,
|
|
178
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").reduce((acc, id) => {
|
|
179
|
+
const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
180
|
+
if (!attachment) {
|
|
181
|
+
return acc;
|
|
182
|
+
}
|
|
183
|
+
acc.push(attachment);
|
|
184
|
+
return acc;
|
|
185
|
+
}, []);
|
|
166
186
|
}
|
|
167
187
|
async visitTestResult(raw, context) {
|
|
168
188
|
const attachmentLinks = [];
|
|
@@ -187,7 +207,7 @@ export class DefaultAllureStore {
|
|
|
187
207
|
}
|
|
188
208
|
testResult.environment = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") || matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), testResult);
|
|
189
209
|
const trHistory = await this.historyByTr(testResult);
|
|
190
|
-
if (trHistory) {
|
|
210
|
+
if (trHistory !== undefined) {
|
|
191
211
|
testResult.transition = getStatusTransition(testResult, trHistory);
|
|
192
212
|
testResult.flaky = isFlaky(testResult, trHistory);
|
|
193
213
|
}
|
|
@@ -211,7 +231,7 @@ export class DefaultAllureStore {
|
|
|
211
231
|
index(this.indexAttachmentByFixture, testFixtureResult.id, ...attachmentLinks);
|
|
212
232
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendTestFixtureResult(testFixtureResult.id);
|
|
213
233
|
}
|
|
214
|
-
async visitAttachmentFile(resultFile
|
|
234
|
+
async visitAttachmentFile(resultFile) {
|
|
215
235
|
const originalFileName = resultFile.getOriginalFileName();
|
|
216
236
|
const id = md5(originalFileName);
|
|
217
237
|
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, resultFile);
|
|
@@ -237,18 +257,42 @@ export class DefaultAllureStore {
|
|
|
237
257
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendAttachmentFile(id);
|
|
238
258
|
}
|
|
239
259
|
async visitMetadata(metadata) {
|
|
240
|
-
Object.keys(metadata).forEach((key) =>
|
|
260
|
+
Object.keys(metadata).forEach((key) => {
|
|
261
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").set(key, metadata[key]);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
async visitGlobals(globals) {
|
|
265
|
+
const { errors, attachments } = globals;
|
|
266
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(...errors);
|
|
267
|
+
attachments.forEach((attachment) => {
|
|
268
|
+
const originalFileName = attachment.originalFileName;
|
|
269
|
+
const id = md5(originalFileName);
|
|
270
|
+
const attachmentLink = {
|
|
271
|
+
id,
|
|
272
|
+
name: attachment?.name || originalFileName,
|
|
273
|
+
originalFileName,
|
|
274
|
+
ext: extname(originalFileName),
|
|
275
|
+
used: true,
|
|
276
|
+
missed: false,
|
|
277
|
+
contentType: attachment?.contentType,
|
|
278
|
+
};
|
|
279
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").set(id, attachmentLink);
|
|
280
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").push(id);
|
|
281
|
+
});
|
|
241
282
|
}
|
|
242
283
|
async allTestCases() {
|
|
243
284
|
return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").values());
|
|
244
285
|
}
|
|
245
286
|
async allTestResults(options = { includeHidden: false }) {
|
|
246
|
-
const { includeHidden } = options;
|
|
287
|
+
const { includeHidden = false, filter } = options;
|
|
247
288
|
const result = [];
|
|
248
289
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
249
290
|
if (!includeHidden && tr.hidden) {
|
|
250
291
|
continue;
|
|
251
292
|
}
|
|
293
|
+
if (typeof filter === "function" && !filter(tr)) {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
252
296
|
result.push(tr);
|
|
253
297
|
}
|
|
254
298
|
return result;
|
|
@@ -306,13 +350,19 @@ export class DefaultAllureStore {
|
|
|
306
350
|
async allKnownIssues() {
|
|
307
351
|
return __classPrivateFieldGet(this, _DefaultAllureStore_known, "f");
|
|
308
352
|
}
|
|
309
|
-
async allNewTestResults() {
|
|
353
|
+
async allNewTestResults(filter) {
|
|
354
|
+
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
355
|
+
return [];
|
|
356
|
+
}
|
|
310
357
|
const newTrs = [];
|
|
311
358
|
const allHistoryDps = await this.allHistoryDataPoints();
|
|
312
359
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
313
360
|
if (tr.hidden) {
|
|
314
361
|
continue;
|
|
315
362
|
}
|
|
363
|
+
if (typeof filter === "function" && !filter(tr)) {
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
316
366
|
if (!tr.historyId) {
|
|
317
367
|
newTrs.push(tr);
|
|
318
368
|
continue;
|
|
@@ -507,7 +557,7 @@ export class DefaultAllureStore {
|
|
|
507
557
|
fixtures: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f")),
|
|
508
558
|
environments: __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"),
|
|
509
559
|
reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
|
|
510
|
-
|
|
560
|
+
globalAttachmentIds: __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"),
|
|
511
561
|
globalErrors: __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"),
|
|
512
562
|
indexLatestEnvTestResultByHistoryId: {},
|
|
513
563
|
indexAttachmentByTestResult: {},
|
|
@@ -516,7 +566,7 @@ export class DefaultAllureStore {
|
|
|
516
566
|
indexAttachmentByFixture: {},
|
|
517
567
|
indexFixturesByTestResult: {},
|
|
518
568
|
indexKnownByHistoryId: {},
|
|
519
|
-
|
|
569
|
+
qualityGateResults: __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f"),
|
|
520
570
|
};
|
|
521
571
|
this.indexLatestEnvTestResultByHistoryId.forEach((envMap) => {
|
|
522
572
|
envMap.forEach((tr, historyId) => {
|
|
@@ -544,14 +594,14 @@ export class DefaultAllureStore {
|
|
|
544
594
|
return storeDump;
|
|
545
595
|
}
|
|
546
596
|
async restoreState(stateDump, attachmentsContents = {}) {
|
|
547
|
-
const { testResults, attachments, testCases, fixtures, reportVariables, environments,
|
|
597
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = stateDump;
|
|
548
598
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f"), testResults);
|
|
549
599
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
550
600
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
551
601
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
552
602
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f"), attachmentsContents);
|
|
553
603
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
554
|
-
__classPrivateFieldGet(this,
|
|
604
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").push(...globalAttachmentIds);
|
|
555
605
|
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(...globalErrors);
|
|
556
606
|
Object.assign(__classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"), reportVariables);
|
|
557
607
|
Object.entries(indexAttachmentByTestResult).forEach(([trId, links]) => {
|
|
@@ -629,10 +679,10 @@ export class DefaultAllureStore {
|
|
|
629
679
|
}
|
|
630
680
|
hidePreviousAttempt(this.indexLatestEnvTestResultByHistoryId, tr);
|
|
631
681
|
});
|
|
632
|
-
|
|
682
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(...qualityGateResults);
|
|
633
683
|
}
|
|
634
684
|
}
|
|
635
|
-
_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(),
|
|
685
|
+
_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_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_addEnvironments = function _DefaultAllureStore_addEnvironments(envs) {
|
|
636
686
|
if (__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").length === 0) {
|
|
637
687
|
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").push(DEFAULT_ENVIRONMENT);
|
|
638
688
|
}
|
package/dist/utils/event.d.ts
CHANGED
|
@@ -15,14 +15,17 @@ export interface AllureStoreEvents {
|
|
|
15
15
|
[RealtimeEvents.TestResult]: [string];
|
|
16
16
|
[RealtimeEvents.TestFixtureResult]: [string];
|
|
17
17
|
[RealtimeEvents.AttachmentFile]: [string];
|
|
18
|
-
[RealtimeEvents.GlobalAttachment]: [
|
|
18
|
+
[RealtimeEvents.GlobalAttachment]: [{
|
|
19
|
+
attachment: ResultFile;
|
|
20
|
+
fileName?: string;
|
|
21
|
+
}];
|
|
19
22
|
[RealtimeEvents.GlobalExitCode]: [ExitCode];
|
|
20
23
|
[RealtimeEvents.GlobalError]: [TestError];
|
|
21
24
|
}
|
|
22
25
|
export declare class RealtimeEventsDispatcher implements RealtimeEventsDispatcherType {
|
|
23
26
|
#private;
|
|
24
27
|
constructor(emitter: EventEmitter<AllureStoreEvents>);
|
|
25
|
-
sendGlobalAttachment(attachment: ResultFile): void;
|
|
28
|
+
sendGlobalAttachment(attachment: ResultFile, fileName?: string): void;
|
|
26
29
|
sendGlobalExitCode(codes: ExitCode): void;
|
|
27
30
|
sendGlobalError(error: TestError): void;
|
|
28
31
|
sendQualityGateResults(payload: QualityGateValidationResult[]): void;
|
|
@@ -33,7 +36,10 @@ export declare class RealtimeEventsDispatcher implements RealtimeEventsDispatche
|
|
|
33
36
|
export declare class RealtimeSubscriber implements RealtimeSubscriberType {
|
|
34
37
|
#private;
|
|
35
38
|
constructor(emitter: EventEmitter<AllureStoreEvents>);
|
|
36
|
-
onGlobalAttachment(listener: (
|
|
39
|
+
onGlobalAttachment(listener: (payload: {
|
|
40
|
+
attachment: ResultFile;
|
|
41
|
+
fileName?: string;
|
|
42
|
+
}) => Promise<void>): () => void;
|
|
37
43
|
onGlobalExitCode(listener: (payload: ExitCode) => Promise<void>): () => void;
|
|
38
44
|
onGlobalError(listener: (error: TestError) => Promise<void>): () => void;
|
|
39
45
|
onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => Promise<void>): () => void;
|
package/dist/utils/event.js
CHANGED
|
@@ -27,8 +27,8 @@ export class RealtimeEventsDispatcher {
|
|
|
27
27
|
_RealtimeEventsDispatcher_emitter.set(this, void 0);
|
|
28
28
|
__classPrivateFieldSet(this, _RealtimeEventsDispatcher_emitter, emitter, "f");
|
|
29
29
|
}
|
|
30
|
-
sendGlobalAttachment(attachment) {
|
|
31
|
-
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalAttachment, attachment);
|
|
30
|
+
sendGlobalAttachment(attachment, fileName) {
|
|
31
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalAttachment, { attachment, fileName });
|
|
32
32
|
}
|
|
33
33
|
sendGlobalExitCode(codes) {
|
|
34
34
|
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalExitCode, codes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,26 +25,25 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.
|
|
29
|
-
"@allurereport/core-api": "3.
|
|
30
|
-
"@allurereport/plugin-allure2": "3.
|
|
31
|
-
"@allurereport/plugin-api": "3.
|
|
32
|
-
"@allurereport/plugin-awesome": "3.
|
|
33
|
-
"@allurereport/plugin-classic": "3.
|
|
34
|
-
"@allurereport/plugin-csv": "3.
|
|
35
|
-
"@allurereport/plugin-dashboard": "3.
|
|
36
|
-
"@allurereport/plugin-jira": "3.
|
|
37
|
-
"@allurereport/plugin-log": "3.
|
|
38
|
-
"@allurereport/plugin-progress": "3.
|
|
39
|
-
"@allurereport/plugin-slack": "3.
|
|
40
|
-
"@allurereport/plugin-testops": "3.
|
|
41
|
-
"@allurereport/plugin-testplan": "3.
|
|
42
|
-
"@allurereport/reader": "3.
|
|
43
|
-
"@allurereport/reader-api": "3.
|
|
44
|
-
"@allurereport/service": "3.
|
|
45
|
-
"@allurereport/summary": "3.
|
|
28
|
+
"@allurereport/ci": "3.2.0",
|
|
29
|
+
"@allurereport/core-api": "3.2.0",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.2.0",
|
|
31
|
+
"@allurereport/plugin-api": "3.2.0",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.2.0",
|
|
33
|
+
"@allurereport/plugin-classic": "3.2.0",
|
|
34
|
+
"@allurereport/plugin-csv": "3.2.0",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.2.0",
|
|
36
|
+
"@allurereport/plugin-jira": "3.2.0",
|
|
37
|
+
"@allurereport/plugin-log": "3.2.0",
|
|
38
|
+
"@allurereport/plugin-progress": "3.2.0",
|
|
39
|
+
"@allurereport/plugin-slack": "3.2.0",
|
|
40
|
+
"@allurereport/plugin-testops": "3.2.0",
|
|
41
|
+
"@allurereport/plugin-testplan": "3.2.0",
|
|
42
|
+
"@allurereport/reader": "3.2.0",
|
|
43
|
+
"@allurereport/reader-api": "3.2.0",
|
|
44
|
+
"@allurereport/service": "3.2.0",
|
|
45
|
+
"@allurereport/summary": "3.2.0",
|
|
46
46
|
"handlebars": "^4.7.8",
|
|
47
|
-
"markdown-it": "^14.1.0",
|
|
48
47
|
"node-stream-zip": "^1.15.0",
|
|
49
48
|
"p-limit": "^7.2.0",
|
|
50
49
|
"progress": "^2.0.3",
|
|
@@ -56,7 +55,6 @@
|
|
|
56
55
|
"@stylistic/eslint-plugin": "^2.6.1",
|
|
57
56
|
"@types/eslint": "^8.56.11",
|
|
58
57
|
"@types/handlebars": "^4.1.0",
|
|
59
|
-
"@types/markdown-it": "^14.1.2",
|
|
60
58
|
"@types/node": "^20.17.9",
|
|
61
59
|
"@types/progress": "^2",
|
|
62
60
|
"@types/zip-stream": "^7.0.0",
|