@allurereport/core 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +3 -2
- package/dist/config.js +2 -0
- package/dist/history.js +33 -11
- package/dist/report.d.ts +1 -1
- package/dist/report.js +45 -40
- package/dist/store/store.d.ts +2 -2
- package/dist/store/store.js +12 -13
- package/package.json +19 -19
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultLabelsConfig, EnvironmentsConfig, KnownTestFailure, ReportVariables } from "@allurereport/core-api";
|
|
1
|
+
import type { CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, KnownTestFailure, ReportVariables } from "@allurereport/core-api";
|
|
2
2
|
import type { Plugin, QualityGateConfig, ReportFiles } from "@allurereport/plugin-api";
|
|
3
3
|
import type { ResultsReader } from "@allurereport/reader-api";
|
|
4
4
|
export interface PluginInstance {
|
|
@@ -16,7 +16,7 @@ export interface FullConfig {
|
|
|
16
16
|
historyLimit?: number;
|
|
17
17
|
knownIssuesPath: string;
|
|
18
18
|
defaultLabels?: DefaultLabelsConfig;
|
|
19
|
-
|
|
19
|
+
dump?: string;
|
|
20
20
|
environment?: string;
|
|
21
21
|
environments?: EnvironmentsConfig;
|
|
22
22
|
variables?: ReportVariables;
|
|
@@ -27,6 +27,7 @@ export interface FullConfig {
|
|
|
27
27
|
known?: KnownTestFailure[];
|
|
28
28
|
realTime?: any;
|
|
29
29
|
qualityGate?: QualityGateConfig;
|
|
30
|
+
categories?: CategoriesConfig;
|
|
30
31
|
allureService?: {
|
|
31
32
|
accessToken?: string;
|
|
32
33
|
};
|
package/dist/config.js
CHANGED
|
@@ -61,6 +61,7 @@ export const validateConfig = (config) => {
|
|
|
61
61
|
"appendHistory",
|
|
62
62
|
"qualityGate",
|
|
63
63
|
"allureService",
|
|
64
|
+
"categories",
|
|
64
65
|
];
|
|
65
66
|
const unsupportedFields = Object.keys(config).filter((key) => !supportedFields.includes(key));
|
|
66
67
|
return {
|
|
@@ -138,6 +139,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
138
139
|
defaultLabels: config.defaultLabels ?? {},
|
|
139
140
|
qualityGate: config.qualityGate,
|
|
140
141
|
allureService: config.allureService,
|
|
142
|
+
categories: config.categories,
|
|
141
143
|
};
|
|
142
144
|
};
|
|
143
145
|
export const readConfig = async (cwd = process.cwd(), configPath, override) => {
|
package/dist/history.js
CHANGED
|
@@ -3,7 +3,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _AllureLocalHistory_cachedHistory, _AllureLocalHistory_openFileToReadIfExists, _AllureLocalHistory_ensureFileOpenedToAppend, _AllureLocalHistory_findFirstEntryAddress, _AllureLocalHistory_throwUnexpectedReadError;
|
|
7
13
|
import { once } from "node:events";
|
|
8
14
|
import { mkdir, open } from "node:fs/promises";
|
|
9
15
|
import path from "node:path";
|
|
@@ -51,6 +57,7 @@ export const createHistory = (reportUuid, reportName = "Allure Report", testCase
|
|
|
51
57
|
export class AllureLocalHistory {
|
|
52
58
|
constructor(params) {
|
|
53
59
|
this.params = params;
|
|
60
|
+
_AllureLocalHistory_cachedHistory.set(this, []);
|
|
54
61
|
_AllureLocalHistory_openFileToReadIfExists.set(this, async (filePath) => {
|
|
55
62
|
try {
|
|
56
63
|
return await open(filePath, "r");
|
|
@@ -121,6 +128,9 @@ export class AllureLocalHistory {
|
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
async readHistory() {
|
|
131
|
+
if (__classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").length > 0) {
|
|
132
|
+
return __classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f");
|
|
133
|
+
}
|
|
124
134
|
const fullPath = path.resolve(this.params.historyPath);
|
|
125
135
|
const historyFile = await __classPrivateFieldGet(this, _AllureLocalHistory_openFileToReadIfExists, "f").call(this, fullPath);
|
|
126
136
|
if (historyFile === undefined) {
|
|
@@ -139,7 +149,8 @@ export class AllureLocalHistory {
|
|
|
139
149
|
}
|
|
140
150
|
});
|
|
141
151
|
await once(readlineInterface, "close");
|
|
142
|
-
|
|
152
|
+
__classPrivateFieldSet(this, _AllureLocalHistory_cachedHistory, historyPoints, "f");
|
|
153
|
+
return __classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f");
|
|
143
154
|
}
|
|
144
155
|
finally {
|
|
145
156
|
await historyFile.close();
|
|
@@ -153,22 +164,33 @@ export class AllureLocalHistory {
|
|
|
153
164
|
const { file: historyFile, exists: historyExists } = await __classPrivateFieldGet(this, _AllureLocalHistory_ensureFileOpenedToAppend, "f").call(this, fullPath);
|
|
154
165
|
try {
|
|
155
166
|
const dst = historyFile.createWriteStream({ encoding: "utf-8", start: 0, autoClose: false });
|
|
156
|
-
if (limit
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const sources = [JSON.stringify(data), Buffer.from([0x0a])];
|
|
163
|
-
await pipeline(sources, dst);
|
|
167
|
+
if (limit === 0 && historyExists) {
|
|
168
|
+
await historyFile.truncate(0);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (limit === 0 && !historyExists) {
|
|
172
|
+
return;
|
|
164
173
|
}
|
|
174
|
+
if (historyExists) {
|
|
175
|
+
const start = await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, limit ? limit - 1 : undefined);
|
|
176
|
+
const src = historyFile.createReadStream({ start, autoClose: false });
|
|
177
|
+
await pipeline(src, dst, { end: false });
|
|
178
|
+
}
|
|
179
|
+
const sources = [JSON.stringify(data), Buffer.from([0x0a])];
|
|
180
|
+
await pipeline(sources, dst);
|
|
165
181
|
if (historyExists) {
|
|
166
182
|
await historyFile.truncate(dst.bytesWritten);
|
|
167
183
|
}
|
|
168
184
|
}
|
|
169
185
|
finally {
|
|
170
186
|
await historyFile.close();
|
|
187
|
+
if (limit !== 0) {
|
|
188
|
+
__classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").push(data);
|
|
189
|
+
}
|
|
190
|
+
if (limit) {
|
|
191
|
+
__classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").splice(limit);
|
|
192
|
+
}
|
|
171
193
|
}
|
|
172
194
|
}
|
|
173
195
|
}
|
|
174
|
-
_AllureLocalHistory_openFileToReadIfExists = new WeakMap(), _AllureLocalHistory_ensureFileOpenedToAppend = new WeakMap(), _AllureLocalHistory_findFirstEntryAddress = new WeakMap(), _AllureLocalHistory_throwUnexpectedReadError = new WeakMap();
|
|
196
|
+
_AllureLocalHistory_cachedHistory = new WeakMap(), _AllureLocalHistory_openFileToReadIfExists = new WeakMap(), _AllureLocalHistory_ensureFileOpenedToAppend = new WeakMap(), _AllureLocalHistory_findFirstEntryAddress = new WeakMap(), _AllureLocalHistory_throwUnexpectedReadError = new WeakMap();
|
package/dist/report.d.ts
CHANGED
package/dist/report.js
CHANGED
|
@@ -9,8 +9,9 @@ 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_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,
|
|
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_dump, _AllureReport_categories, _AllureReport_dumpTempDirs, _AllureReport_state, _AllureReport_executionStage, _AllureReport_publish_get, _AllureReport_update, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
13
13
|
import { detect } from "@allurereport/ci";
|
|
14
|
+
import { normalizeCategoriesConfig } from "@allurereport/core-api";
|
|
14
15
|
import { AllureStoreDumpFiles, } from "@allurereport/plugin-api";
|
|
15
16
|
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
16
17
|
import { PathResultFile } from "@allurereport/reader-api";
|
|
@@ -53,8 +54,9 @@ export class AllureReport {
|
|
|
53
54
|
_AllureReport_history.set(this, void 0);
|
|
54
55
|
_AllureReport_allureServiceClient.set(this, void 0);
|
|
55
56
|
_AllureReport_qualityGate.set(this, void 0);
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
_AllureReport_dump.set(this, void 0);
|
|
58
|
+
_AllureReport_categories.set(this, void 0);
|
|
59
|
+
_AllureReport_dumpTempDirs.set(this, []);
|
|
58
60
|
_AllureReport_state.set(this, void 0);
|
|
59
61
|
_AllureReport_executionStage.set(this, "init");
|
|
60
62
|
this.readDirectory = async (resultsDir) => {
|
|
@@ -150,7 +152,7 @@ export class AllureReport {
|
|
|
150
152
|
zlib: { level: 5 },
|
|
151
153
|
});
|
|
152
154
|
const addEntry = promisify(dumpArchive.entry.bind(dumpArchive));
|
|
153
|
-
const dumpArchiveWriteStream = createWriteStream(`${__classPrivateFieldGet(this,
|
|
155
|
+
const dumpArchiveWriteStream = createWriteStream(`${__classPrivateFieldGet(this, _AllureReport_dump, "f")}.zip`);
|
|
154
156
|
const promise = new Promise((res, rej) => {
|
|
155
157
|
dumpArchive.on("error", (err) => rej(err));
|
|
156
158
|
dumpArchiveWriteStream.on("finish", () => res(void 0));
|
|
@@ -224,31 +226,31 @@ export class AllureReport {
|
|
|
224
226
|
dumpArchive.finalize();
|
|
225
227
|
return promise;
|
|
226
228
|
};
|
|
227
|
-
this.restoreState = async (
|
|
228
|
-
for (const
|
|
229
|
-
if (!existsSync(
|
|
229
|
+
this.restoreState = async (dumps) => {
|
|
230
|
+
for (const dump of dumps) {
|
|
231
|
+
if (!existsSync(dump)) {
|
|
230
232
|
continue;
|
|
231
233
|
}
|
|
232
|
-
const
|
|
233
|
-
file:
|
|
234
|
+
const dumpArchive = new ZipReadStream.async({
|
|
235
|
+
file: dump,
|
|
234
236
|
});
|
|
235
|
-
const testResultsEntry = await
|
|
236
|
-
const testCasesEntry = await
|
|
237
|
-
const fixturesEntry = await
|
|
238
|
-
const attachmentsEntry = await
|
|
239
|
-
const environmentsEntry = await
|
|
240
|
-
const reportVariablesEntry = await
|
|
241
|
-
const globalAttachmentsEntry = await
|
|
242
|
-
const globalErrorsEntry = await
|
|
243
|
-
const indexAttachmentsEntry = await
|
|
244
|
-
const indexTestResultsByHistoryId = await
|
|
245
|
-
const indexTestResultsByTestCaseEntry = await
|
|
246
|
-
const indexLatestEnvTestResultsByHistoryIdEntry = await
|
|
247
|
-
const indexAttachmentsByFixtureEntry = await
|
|
248
|
-
const indexFixturesByTestResultEntry = await
|
|
249
|
-
const indexKnownByHistoryIdEntry = await
|
|
250
|
-
const qualityGateResultsEntry = await
|
|
251
|
-
const attachmentsEntries = Object.entries(await
|
|
237
|
+
const testResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestResults);
|
|
238
|
+
const testCasesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestCases);
|
|
239
|
+
const fixturesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Fixtures);
|
|
240
|
+
const attachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Attachments);
|
|
241
|
+
const environmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Environments);
|
|
242
|
+
const reportVariablesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.ReportVariables);
|
|
243
|
+
const globalAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
244
|
+
const globalErrorsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalErrors);
|
|
245
|
+
const indexAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
246
|
+
const indexTestResultsByHistoryId = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
247
|
+
const indexTestResultsByTestCaseEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
248
|
+
const indexLatestEnvTestResultsByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId);
|
|
249
|
+
const indexAttachmentsByFixtureEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
250
|
+
const indexFixturesByTestResultEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
251
|
+
const indexKnownByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
252
|
+
const qualityGateResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.QualityGateResults);
|
|
253
|
+
const attachmentsEntries = Object.entries(await dumpArchive.entries()).reduce((acc, [entryName, entry]) => {
|
|
252
254
|
switch (entryName) {
|
|
253
255
|
case AllureStoreDumpFiles.Attachments:
|
|
254
256
|
case AllureStoreDumpFiles.TestResults:
|
|
@@ -291,23 +293,23 @@ export class AllureReport {
|
|
|
291
293
|
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
292
294
|
qualityGateResults: JSON.parse(qualityGateResultsEntry.toString("utf8")),
|
|
293
295
|
};
|
|
294
|
-
const
|
|
296
|
+
const dumpTempDir = await mkdtemp(join(tmpdir(), basename(dump, ".zip")));
|
|
295
297
|
const resultsAttachments = {};
|
|
296
|
-
__classPrivateFieldGet(this,
|
|
298
|
+
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(dumpTempDir);
|
|
297
299
|
try {
|
|
298
300
|
for (const [attachmentId] of Object.entries(attachmentsEntries)) {
|
|
299
|
-
const attachmentContentEntry = await
|
|
300
|
-
const attachmentFilePath = join(
|
|
301
|
+
const attachmentContentEntry = await dumpArchive.entryData(attachmentId);
|
|
302
|
+
const attachmentFilePath = join(dumpTempDir, attachmentId);
|
|
301
303
|
await writeFile(attachmentFilePath, attachmentContentEntry);
|
|
302
304
|
resultsAttachments[attachmentId] = new PathResultFile(attachmentFilePath, attachmentId);
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
307
|
catch (err) {
|
|
306
|
-
console.error(`Can't restore state from "${
|
|
308
|
+
console.error(`Can't restore state from "${dump}", continuing without it`);
|
|
307
309
|
console.error(err);
|
|
308
310
|
}
|
|
309
311
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments);
|
|
310
|
-
console.info(`Successfully restored state from "${
|
|
312
|
+
console.info(`Successfully restored state from "${dump}"`);
|
|
311
313
|
}
|
|
312
314
|
};
|
|
313
315
|
this.done = async () => {
|
|
@@ -322,7 +324,7 @@ export class AllureReport {
|
|
|
322
324
|
const historyDataPoint = createHistory(this.reportUuid, __classPrivateFieldGet(this, _AllureReport_reportName, "f"), testCases, testResults, this.reportUrl);
|
|
323
325
|
__classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f").offAll();
|
|
324
326
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
325
|
-
if (__classPrivateFieldGet(this,
|
|
327
|
+
if (__classPrivateFieldGet(this, _AllureReport_dump, "f")) {
|
|
326
328
|
await this.dumpState();
|
|
327
329
|
return;
|
|
328
330
|
}
|
|
@@ -430,7 +432,7 @@ export class AllureReport {
|
|
|
430
432
|
}
|
|
431
433
|
await rm(reportPath, { recursive: true });
|
|
432
434
|
}
|
|
433
|
-
for (const dir of __classPrivateFieldGet(this,
|
|
435
|
+
for (const dir of __classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f")) {
|
|
434
436
|
try {
|
|
435
437
|
await rm(dir, { recursive: true });
|
|
436
438
|
}
|
|
@@ -499,6 +501,8 @@ export class AllureReport {
|
|
|
499
501
|
reportUrl: this.reportUrl,
|
|
500
502
|
output: __classPrivateFieldGet(this, _AllureReport_output, "f"),
|
|
501
503
|
ci: __classPrivateFieldGet(this, _AllureReport_ci, "f"),
|
|
504
|
+
categories: __classPrivateFieldGet(this, _AllureReport_categories, "f"),
|
|
505
|
+
history: __classPrivateFieldGet(this, _AllureReport_history, "f"),
|
|
502
506
|
};
|
|
503
507
|
try {
|
|
504
508
|
await consumer.call(this, plugin, pluginContext);
|
|
@@ -511,7 +515,7 @@ export class AllureReport {
|
|
|
511
515
|
}
|
|
512
516
|
}
|
|
513
517
|
});
|
|
514
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate,
|
|
518
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate, dump, categories, allureService: allureServiceConfig, } = opts;
|
|
515
519
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.accessToken
|
|
516
520
|
? new AllureServiceClient(allureServiceConfig)
|
|
517
521
|
: undefined, "f");
|
|
@@ -524,21 +528,22 @@ export class AllureReport {
|
|
|
524
528
|
__classPrivateFieldSet(this, _AllureReport_realtimeDispatcher, new RealtimeEventsDispatcher(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
525
529
|
__classPrivateFieldSet(this, _AllureReport_realtimeSubscriber, new RealtimeSubscriber(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
526
530
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
527
|
-
__classPrivateFieldSet(this,
|
|
531
|
+
__classPrivateFieldSet(this, _AllureReport_dump, dump, "f");
|
|
528
532
|
if (qualityGate) {
|
|
529
533
|
__classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
|
|
530
534
|
}
|
|
535
|
+
__classPrivateFieldSet(this, _AllureReport_categories, normalizeCategoriesConfig(categories), "f");
|
|
531
536
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
532
537
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
533
|
-
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
534
|
-
branch: __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch,
|
|
535
538
|
limit: historyLimit,
|
|
539
|
+
branch: __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch,
|
|
540
|
+
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
536
541
|
}), "f");
|
|
537
542
|
}
|
|
538
543
|
else if (historyPath) {
|
|
539
544
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureLocalHistory({
|
|
540
|
-
historyPath,
|
|
541
545
|
limit: historyLimit,
|
|
546
|
+
historyPath,
|
|
542
547
|
}), "f");
|
|
543
548
|
}
|
|
544
549
|
__classPrivateFieldSet(this, _AllureReport_store, new DefaultAllureStore({
|
|
@@ -569,7 +574,7 @@ export class AllureReport {
|
|
|
569
574
|
return __classPrivateFieldGet(this, _AllureReport_realtimeDispatcher, "f");
|
|
570
575
|
}
|
|
571
576
|
}
|
|
572
|
-
_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(),
|
|
577
|
+
_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_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_dumpTempDirs = 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() {
|
|
573
578
|
return __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ enabled, options }) => enabled && options.publish);
|
|
574
579
|
}, _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
575
580
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
package/dist/store/store.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
48
48
|
allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
|
|
49
49
|
allHistoryDataPointsByEnvironment(environment: string): Promise<HistoryDataPoint[]>;
|
|
50
50
|
allKnownIssues(): Promise<KnownTestFailure[]>;
|
|
51
|
-
allNewTestResults(filter?: TestResultFilter): Promise<TestResult[]>;
|
|
51
|
+
allNewTestResults(filter?: TestResultFilter, history?: HistoryDataPoint[]): Promise<TestResult[]>;
|
|
52
52
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
53
53
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
|
54
54
|
attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
|
|
@@ -64,8 +64,8 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
64
64
|
failedTestResults(): Promise<TestResult[]>;
|
|
65
65
|
unknownFailedTestResults(): Promise<TestResult[]>;
|
|
66
66
|
testResultsByLabel(labelName: string): Promise<{
|
|
67
|
-
[x: string]: TestResult[];
|
|
68
67
|
_: TestResult[];
|
|
68
|
+
[x: string]: TestResult[];
|
|
69
69
|
}>;
|
|
70
70
|
testsStatistic(filter?: TestResultFilter): Promise<Statistic>;
|
|
71
71
|
allEnvironments(): Promise<string[]>;
|
package/dist/store/store.js
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
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
|
-
import { DEFAULT_ENVIRONMENT, compareBy, getWorstStatus, htrsByTr, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
13
|
+
import { DEFAULT_ENVIRONMENT, compareBy, createDictionary, getWorstStatus, htrsByTr, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
14
|
import { md5, } from "@allurereport/plugin-api";
|
|
15
15
|
import { extname } from "node:path";
|
|
16
16
|
import { isFlaky } from "../utils/flaky.js";
|
|
@@ -158,7 +158,7 @@ export class DefaultAllureStore {
|
|
|
158
158
|
return __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f");
|
|
159
159
|
}
|
|
160
160
|
async qualityGateResultsByEnv() {
|
|
161
|
-
const resultsByEnv =
|
|
161
|
+
const resultsByEnv = createDictionary();
|
|
162
162
|
for (const result of __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f")) {
|
|
163
163
|
const environment = result.environment || "default";
|
|
164
164
|
if (!resultsByEnv[environment]) {
|
|
@@ -350,12 +350,16 @@ export class DefaultAllureStore {
|
|
|
350
350
|
async allKnownIssues() {
|
|
351
351
|
return __classPrivateFieldGet(this, _DefaultAllureStore_known, "f");
|
|
352
352
|
}
|
|
353
|
-
async allNewTestResults(filter) {
|
|
354
|
-
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
353
|
+
async allNewTestResults(filter, history) {
|
|
354
|
+
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f") && !history) {
|
|
355
355
|
return [];
|
|
356
356
|
}
|
|
357
|
+
const allHistoryDps = history ?? (await this.allHistoryDataPoints());
|
|
358
|
+
if (allHistoryDps.length === 0) {
|
|
359
|
+
return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values());
|
|
360
|
+
}
|
|
361
|
+
const historicalIds = new Set(allHistoryDps.flatMap((dp) => Object.keys(dp.testResults)));
|
|
357
362
|
const newTrs = [];
|
|
358
|
-
const allHistoryDps = await this.allHistoryDataPoints();
|
|
359
363
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
360
364
|
if (tr.hidden) {
|
|
361
365
|
continue;
|
|
@@ -363,11 +367,7 @@ export class DefaultAllureStore {
|
|
|
363
367
|
if (typeof filter === "function" && !filter(tr)) {
|
|
364
368
|
continue;
|
|
365
369
|
}
|
|
366
|
-
if (!tr.historyId) {
|
|
367
|
-
newTrs.push(tr);
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
if (!allHistoryDps.some((dp) => dp.testResults[tr.historyId])) {
|
|
370
|
+
if (!tr.historyId || !historicalIds.has(tr.historyId)) {
|
|
371
371
|
newTrs.push(tr);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
@@ -443,9 +443,8 @@ export class DefaultAllureStore {
|
|
|
443
443
|
return failedTestResults.filter(({ historyId }) => historyId && !knownHistoryIds.includes(historyId));
|
|
444
444
|
}
|
|
445
445
|
async testResultsByLabel(labelName) {
|
|
446
|
-
const results =
|
|
447
|
-
|
|
448
|
-
};
|
|
446
|
+
const results = createDictionary();
|
|
447
|
+
results._ = [];
|
|
449
448
|
for (const [, test] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
450
449
|
if (test.hidden) {
|
|
451
450
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,24 +25,24 @@
|
|
|
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.3.1",
|
|
29
|
+
"@allurereport/core-api": "3.3.1",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.3.1",
|
|
31
|
+
"@allurereport/plugin-api": "3.3.1",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.3.1",
|
|
33
|
+
"@allurereport/plugin-classic": "3.3.1",
|
|
34
|
+
"@allurereport/plugin-csv": "3.3.1",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.3.1",
|
|
36
|
+
"@allurereport/plugin-jira": "3.3.1",
|
|
37
|
+
"@allurereport/plugin-log": "3.3.1",
|
|
38
|
+
"@allurereport/plugin-progress": "3.3.1",
|
|
39
|
+
"@allurereport/plugin-slack": "3.3.1",
|
|
40
|
+
"@allurereport/plugin-testops": "3.3.1",
|
|
41
|
+
"@allurereport/plugin-testplan": "3.3.1",
|
|
42
|
+
"@allurereport/reader": "3.3.1",
|
|
43
|
+
"@allurereport/reader-api": "3.3.1",
|
|
44
|
+
"@allurereport/service": "3.3.1",
|
|
45
|
+
"@allurereport/summary": "3.3.1",
|
|
46
46
|
"handlebars": "^4.7.8",
|
|
47
47
|
"node-stream-zip": "^1.15.0",
|
|
48
48
|
"p-limit": "^7.2.0",
|