@allurereport/core 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +4 -2
- package/dist/config.d.ts +2 -0
- package/dist/config.js +73 -6
- package/dist/history.d.ts +1 -1
- package/dist/history.js +39 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/plugin.js +2 -1
- package/dist/qualityGate/qualityGate.js +2 -2
- package/dist/qualityGate/rules.d.ts +3 -1
- package/dist/qualityGate/rules.js +40 -6
- package/dist/report.d.ts +1 -1
- package/dist/report.js +71 -48
- package/dist/store/convert.js +1 -1
- package/dist/store/store.d.ts +16 -5
- package/dist/store/store.js +376 -72
- package/dist/utils/environment.d.ts +24 -0
- package/dist/utils/environment.js +160 -0
- package/dist/utils/event.d.ts +1 -1
- package/dist/utils/safeDumpPath.d.ts +4 -0
- package/dist/utils/safeDumpPath.js +22 -0
- package/dist/utils/safeOutputPath.d.ts +5 -0
- package/dist/utils/safeOutputPath.js +31 -0
- package/dist/utils/windows.d.ts +2 -0
- package/dist/utils/windows.js +51 -0
- package/package.json +30 -42
package/dist/report.js
CHANGED
|
@@ -9,14 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _AllureReport_instances, _AllureReport_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,
|
|
13
|
-
import { detect } from "@allurereport/ci";
|
|
14
|
-
import { AllureStoreDumpFiles, } from "@allurereport/plugin-api";
|
|
15
|
-
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
16
|
-
import { PathResultFile } from "@allurereport/reader-api";
|
|
17
|
-
import { AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError } from "@allurereport/service";
|
|
18
|
-
import { generateSummary } from "@allurereport/summary";
|
|
19
|
-
import ZipReadStream from "node-stream-zip";
|
|
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_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_dumpTempDirs, _AllureReport_state, _AllureReport_executionStage, _AllureReport_publish_get, _AllureReport_update, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
20
13
|
import console from "node:console";
|
|
21
14
|
import { randomUUID } from "node:crypto";
|
|
22
15
|
import { EventEmitter } from "node:events";
|
|
@@ -25,6 +18,14 @@ import { lstat, mkdtemp, opendir, readdir, realpath, rename, rm, writeFile } fro
|
|
|
25
18
|
import { tmpdir } from "node:os";
|
|
26
19
|
import { basename, dirname, join, resolve } from "node:path";
|
|
27
20
|
import { promisify } from "node:util";
|
|
21
|
+
import { detect } from "@allurereport/ci";
|
|
22
|
+
import { normalizeCategoriesConfig } from "@allurereport/core-api";
|
|
23
|
+
import { AllureStoreDumpFiles, } from "@allurereport/plugin-api";
|
|
24
|
+
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
25
|
+
import { PathResultFile } from "@allurereport/reader-api";
|
|
26
|
+
import { AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError } from "@allurereport/service";
|
|
27
|
+
import { generateSummary } from "@allurereport/summary";
|
|
28
|
+
import ZipReadStream from "node-stream-zip";
|
|
28
29
|
import pLimit from "p-limit";
|
|
29
30
|
import ProgressBar from "progress";
|
|
30
31
|
import ZipWriteStream from "zip-stream";
|
|
@@ -32,7 +33,9 @@ import { AllureLocalHistory, createHistory } from "./history.js";
|
|
|
32
33
|
import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
33
34
|
import { QualityGate } from "./qualityGate/index.js";
|
|
34
35
|
import { DefaultAllureStore } from "./store/store.js";
|
|
36
|
+
import { environmentIdentityById, environmentIdentityByName } from "./utils/environment.js";
|
|
35
37
|
import { RealtimeEventsDispatcher, RealtimeSubscriber } from "./utils/event.js";
|
|
38
|
+
import { resolveDumpAttachmentPath, UnsafeDumpPathError } from "./utils/safeDumpPath.js";
|
|
36
39
|
const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
37
40
|
const initRequired = "report is not initialised. Call the start() method first.";
|
|
38
41
|
export class AllureReport {
|
|
@@ -49,12 +52,15 @@ export class AllureReport {
|
|
|
49
52
|
_AllureReport_realtimeSubscriber.set(this, void 0);
|
|
50
53
|
_AllureReport_realtimeDispatcher.set(this, void 0);
|
|
51
54
|
_AllureReport_realTime.set(this, void 0);
|
|
55
|
+
_AllureReport_hideLabels.set(this, void 0);
|
|
52
56
|
_AllureReport_output.set(this, void 0);
|
|
53
57
|
_AllureReport_history.set(this, void 0);
|
|
54
58
|
_AllureReport_allureServiceClient.set(this, void 0);
|
|
55
59
|
_AllureReport_qualityGate.set(this, void 0);
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
_AllureReport_dump.set(this, void 0);
|
|
61
|
+
_AllureReport_categories.set(this, void 0);
|
|
62
|
+
_AllureReport_environments.set(this, void 0);
|
|
63
|
+
_AllureReport_dumpTempDirs.set(this, []);
|
|
58
64
|
_AllureReport_state.set(this, void 0);
|
|
59
65
|
_AllureReport_executionStage.set(this, "init");
|
|
60
66
|
this.readDirectory = async (resultsDir) => {
|
|
@@ -100,11 +106,16 @@ export class AllureReport {
|
|
|
100
106
|
};
|
|
101
107
|
this.validate = async (params) => {
|
|
102
108
|
const { trs, knownIssues, state, environment } = params;
|
|
109
|
+
const qualityGateEnvironment = environment === undefined
|
|
110
|
+
? undefined
|
|
111
|
+
: (environmentIdentityById(__classPrivateFieldGet(this, _AllureReport_environments, "f"), environment)?.name ??
|
|
112
|
+
environmentIdentityByName(__classPrivateFieldGet(this, _AllureReport_environments, "f"), environment)?.name ??
|
|
113
|
+
environment);
|
|
103
114
|
return __classPrivateFieldGet(this, _AllureReport_qualityGate, "f").validate({
|
|
104
115
|
trs: trs.filter(Boolean),
|
|
105
116
|
knownIssues,
|
|
106
117
|
state,
|
|
107
|
-
environment,
|
|
118
|
+
environment: qualityGateEnvironment,
|
|
108
119
|
});
|
|
109
120
|
};
|
|
110
121
|
this.start = async () => {
|
|
@@ -150,7 +161,7 @@ export class AllureReport {
|
|
|
150
161
|
zlib: { level: 5 },
|
|
151
162
|
});
|
|
152
163
|
const addEntry = promisify(dumpArchive.entry.bind(dumpArchive));
|
|
153
|
-
const dumpArchiveWriteStream = createWriteStream(`${__classPrivateFieldGet(this,
|
|
164
|
+
const dumpArchiveWriteStream = createWriteStream(`${__classPrivateFieldGet(this, _AllureReport_dump, "f")}.zip`);
|
|
154
165
|
const promise = new Promise((res, rej) => {
|
|
155
166
|
dumpArchive.on("error", (err) => rej(err));
|
|
156
167
|
dumpArchiveWriteStream.on("finish", () => res(void 0));
|
|
@@ -224,31 +235,31 @@ export class AllureReport {
|
|
|
224
235
|
dumpArchive.finalize();
|
|
225
236
|
return promise;
|
|
226
237
|
};
|
|
227
|
-
this.restoreState = async (
|
|
228
|
-
for (const
|
|
229
|
-
if (!existsSync(
|
|
238
|
+
this.restoreState = async (dumps) => {
|
|
239
|
+
for (const dump of dumps) {
|
|
240
|
+
if (!existsSync(dump)) {
|
|
230
241
|
continue;
|
|
231
242
|
}
|
|
232
|
-
const
|
|
233
|
-
file:
|
|
243
|
+
const dumpArchive = new ZipReadStream.async({
|
|
244
|
+
file: dump,
|
|
234
245
|
});
|
|
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
|
|
246
|
+
const testResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestResults);
|
|
247
|
+
const testCasesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestCases);
|
|
248
|
+
const fixturesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Fixtures);
|
|
249
|
+
const attachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Attachments);
|
|
250
|
+
const environmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Environments);
|
|
251
|
+
const reportVariablesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.ReportVariables);
|
|
252
|
+
const globalAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
253
|
+
const globalErrorsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalErrors);
|
|
254
|
+
const indexAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
255
|
+
const indexTestResultsByHistoryId = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
256
|
+
const indexTestResultsByTestCaseEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
257
|
+
const indexLatestEnvTestResultsByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId);
|
|
258
|
+
const indexAttachmentsByFixtureEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
259
|
+
const indexFixturesByTestResultEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
260
|
+
const indexKnownByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
261
|
+
const qualityGateResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.QualityGateResults);
|
|
262
|
+
const attachmentsEntries = Object.entries(await dumpArchive.entries()).reduce((acc, [entryName, entry]) => {
|
|
252
263
|
switch (entryName) {
|
|
253
264
|
case AllureStoreDumpFiles.Attachments:
|
|
254
265
|
case AllureStoreDumpFiles.TestResults:
|
|
@@ -291,23 +302,29 @@ export class AllureReport {
|
|
|
291
302
|
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
292
303
|
qualityGateResults: JSON.parse(qualityGateResultsEntry.toString("utf8")),
|
|
293
304
|
};
|
|
294
|
-
const
|
|
305
|
+
const dumpTempDir = await mkdtemp(join(tmpdir(), basename(dump, ".zip")));
|
|
295
306
|
const resultsAttachments = {};
|
|
296
|
-
__classPrivateFieldGet(this,
|
|
307
|
+
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(dumpTempDir);
|
|
297
308
|
try {
|
|
298
309
|
for (const [attachmentId] of Object.entries(attachmentsEntries)) {
|
|
299
|
-
const attachmentContentEntry = await
|
|
300
|
-
const attachmentFilePath =
|
|
310
|
+
const attachmentContentEntry = await dumpArchive.entryData(attachmentId);
|
|
311
|
+
const attachmentFilePath = resolveDumpAttachmentPath(dumpTempDir, attachmentId);
|
|
301
312
|
await writeFile(attachmentFilePath, attachmentContentEntry);
|
|
302
313
|
resultsAttachments[attachmentId] = new PathResultFile(attachmentFilePath, attachmentId);
|
|
303
314
|
}
|
|
304
315
|
}
|
|
305
316
|
catch (err) {
|
|
306
|
-
|
|
317
|
+
if (err instanceof UnsafeDumpPathError) {
|
|
318
|
+
console.error(`Cannot restore dump from "${dump}": the archive lists attachment paths that would write outside the extract directory (unsafe zip paths such as "../" or absolute names).`);
|
|
319
|
+
console.error(err.message);
|
|
320
|
+
console.error("Only use dump archives produced by this tool; do not load untrusted or third-party --dump zip files.");
|
|
321
|
+
throw err;
|
|
322
|
+
}
|
|
323
|
+
console.error(`Can't restore state from "${dump}", continuing without it`);
|
|
307
324
|
console.error(err);
|
|
308
325
|
}
|
|
309
326
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments);
|
|
310
|
-
console.info(`Successfully restored state from "${
|
|
327
|
+
console.info(`Successfully restored state from "${dump}"`);
|
|
311
328
|
}
|
|
312
329
|
};
|
|
313
330
|
this.done = async () => {
|
|
@@ -322,7 +339,7 @@ export class AllureReport {
|
|
|
322
339
|
const historyDataPoint = createHistory(this.reportUuid, __classPrivateFieldGet(this, _AllureReport_reportName, "f"), testCases, testResults, this.reportUrl);
|
|
323
340
|
__classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f").offAll();
|
|
324
341
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
325
|
-
if (__classPrivateFieldGet(this,
|
|
342
|
+
if (__classPrivateFieldGet(this, _AllureReport_dump, "f")) {
|
|
326
343
|
await this.dumpState();
|
|
327
344
|
return;
|
|
328
345
|
}
|
|
@@ -430,7 +447,7 @@ export class AllureReport {
|
|
|
430
447
|
}
|
|
431
448
|
await rm(reportPath, { recursive: true });
|
|
432
449
|
}
|
|
433
|
-
for (const dir of __classPrivateFieldGet(this,
|
|
450
|
+
for (const dir of __classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f")) {
|
|
434
451
|
try {
|
|
435
452
|
await rm(dir, { recursive: true });
|
|
436
453
|
}
|
|
@@ -494,11 +511,14 @@ export class AllureReport {
|
|
|
494
511
|
allureVersion: version,
|
|
495
512
|
reportUuid: this.reportUuid,
|
|
496
513
|
reportName: __classPrivateFieldGet(this, _AllureReport_reportName, "f"),
|
|
514
|
+
hideLabels: __classPrivateFieldGet(this, _AllureReport_hideLabels, "f"),
|
|
497
515
|
state: pluginState,
|
|
498
516
|
reportFiles: pluginFiles,
|
|
499
517
|
reportUrl: this.reportUrl,
|
|
500
518
|
output: __classPrivateFieldGet(this, _AllureReport_output, "f"),
|
|
501
519
|
ci: __classPrivateFieldGet(this, _AllureReport_ci, "f"),
|
|
520
|
+
categories: __classPrivateFieldGet(this, _AllureReport_categories, "f"),
|
|
521
|
+
history: __classPrivateFieldGet(this, _AllureReport_history, "f"),
|
|
502
522
|
};
|
|
503
523
|
try {
|
|
504
524
|
await consumer.call(this, plugin, pluginContext);
|
|
@@ -511,7 +531,7 @@ export class AllureReport {
|
|
|
511
531
|
}
|
|
512
532
|
}
|
|
513
533
|
});
|
|
514
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate,
|
|
534
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, environments, output, hideLabels, qualityGate, dump, categories, allureService: allureServiceConfig, } = opts;
|
|
515
535
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.accessToken
|
|
516
536
|
? new AllureServiceClient(allureServiceConfig)
|
|
517
537
|
: undefined, "f");
|
|
@@ -524,21 +544,24 @@ export class AllureReport {
|
|
|
524
544
|
__classPrivateFieldSet(this, _AllureReport_realtimeDispatcher, new RealtimeEventsDispatcher(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
525
545
|
__classPrivateFieldSet(this, _AllureReport_realtimeSubscriber, new RealtimeSubscriber(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
526
546
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
527
|
-
__classPrivateFieldSet(this,
|
|
547
|
+
__classPrivateFieldSet(this, _AllureReport_dump, dump, "f");
|
|
548
|
+
__classPrivateFieldSet(this, _AllureReport_hideLabels, hideLabels, "f");
|
|
549
|
+
__classPrivateFieldSet(this, _AllureReport_environments, environments ?? {}, "f");
|
|
528
550
|
if (qualityGate) {
|
|
529
551
|
__classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
|
|
530
552
|
}
|
|
553
|
+
__classPrivateFieldSet(this, _AllureReport_categories, normalizeCategoriesConfig(categories), "f");
|
|
531
554
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
532
555
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
533
|
-
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
534
|
-
branch: __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch,
|
|
535
556
|
limit: historyLimit,
|
|
557
|
+
branch: __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch,
|
|
558
|
+
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
536
559
|
}), "f");
|
|
537
560
|
}
|
|
538
561
|
else if (historyPath) {
|
|
539
562
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureLocalHistory({
|
|
540
|
-
historyPath,
|
|
541
563
|
limit: historyLimit,
|
|
564
|
+
historyPath,
|
|
542
565
|
}), "f");
|
|
543
566
|
}
|
|
544
567
|
__classPrivateFieldSet(this, _AllureReport_store, new DefaultAllureStore({
|
|
@@ -569,7 +592,7 @@ export class AllureReport {
|
|
|
569
592
|
return __classPrivateFieldGet(this, _AllureReport_realtimeDispatcher, "f");
|
|
570
593
|
}
|
|
571
594
|
}
|
|
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(),
|
|
595
|
+
_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_hideLabels = 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_environments = 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
596
|
return __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ enabled, options }) => enabled && options.publish);
|
|
574
597
|
}, _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
575
598
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
package/dist/store/convert.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import { findByLabelName, notNull } from "@allurereport/core-api";
|
|
2
3
|
import { md5 } from "@allurereport/plugin-api";
|
|
3
4
|
import { extension, lookupContentType } from "@allurereport/reader-api";
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
5
|
const defaultStatus = "unknown";
|
|
6
6
|
export const __unknown = "#___unknown_value___#";
|
|
7
7
|
export const testFixtureResultRawToState = (stateData, raw, context) => {
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
import { type AllureHistory, type AttachmentLink, type AttachmentLinkLinked, type DefaultLabelsConfig, type EnvironmentIdentity, 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
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>;
|
|
@@ -6,6 +6,7 @@ export declare const updateMapWithRecord: <K extends string | number | symbol, T
|
|
|
6
6
|
export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
7
7
|
#private;
|
|
8
8
|
readonly indexTestResultByTestCase: Map<string, TestResult[]>;
|
|
9
|
+
readonly indexTestResultByEnvironmentId: Map<string, TestResult[]>;
|
|
9
10
|
readonly indexLatestEnvTestResultByHistoryId: Map<string, Map<string, TestResult>>;
|
|
10
11
|
readonly indexTestResultByHistoryId: Map<string, TestResult[]>;
|
|
11
12
|
readonly indexAttachmentByTestResult: Map<string, AttachmentLink[]>;
|
|
@@ -26,6 +27,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
26
27
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
27
28
|
qualityGateResults(): Promise<QualityGateValidationResult[]>;
|
|
28
29
|
qualityGateResultsByEnv(): Promise<Record<string, QualityGateValidationResult[]>>;
|
|
30
|
+
qualityGateResultsByEnvironmentId(): Promise<Record<string, QualityGateValidationResult[]>>;
|
|
29
31
|
globalExitCode(): Promise<ExitCode | undefined>;
|
|
30
32
|
allGlobalErrors(): Promise<TestError[]>;
|
|
31
33
|
allGlobalAttachments(): Promise<AttachmentLinkLinked[]>;
|
|
@@ -47,16 +49,18 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
47
49
|
allFixtures(): Promise<TestFixtureResult[]>;
|
|
48
50
|
allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
|
|
49
51
|
allHistoryDataPointsByEnvironment(environment: string): Promise<HistoryDataPoint[]>;
|
|
52
|
+
allHistoryDataPointsByEnvironmentId(environmentId: string): Promise<HistoryDataPoint[]>;
|
|
50
53
|
allKnownIssues(): Promise<KnownTestFailure[]>;
|
|
51
|
-
allNewTestResults(filter?: TestResultFilter): Promise<TestResult[]>;
|
|
54
|
+
allNewTestResults(filter?: TestResultFilter, history?: HistoryDataPoint[]): Promise<TestResult[]>;
|
|
52
55
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
53
56
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
|
54
57
|
attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
|
|
55
58
|
attachmentContentById(attachmentId: string): Promise<ResultFile | undefined>;
|
|
56
59
|
metadataByKey<T>(key: string): Promise<T | undefined>;
|
|
57
60
|
testResultsByTcId(tcId: string): Promise<TestResult[]>;
|
|
61
|
+
environmentIdByTrId(trId: string): Promise<string | undefined>;
|
|
58
62
|
attachmentsByTrId(trId: string): Promise<AttachmentLink[]>;
|
|
59
|
-
retriesByTr(tr
|
|
63
|
+
retriesByTr(tr?: TestResult): Promise<TestResult[]>;
|
|
60
64
|
retriesByTrId(trId: string): Promise<TestResult[]>;
|
|
61
65
|
historyByTr(tr: TestResult): Promise<HistoryTestResult[] | undefined>;
|
|
62
66
|
historyByTrId(trId: string): Promise<HistoryTestResult[] | undefined>;
|
|
@@ -64,19 +68,26 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
64
68
|
failedTestResults(): Promise<TestResult[]>;
|
|
65
69
|
unknownFailedTestResults(): Promise<TestResult[]>;
|
|
66
70
|
testResultsByLabel(labelName: string): Promise<{
|
|
67
|
-
[x: string]: TestResult[];
|
|
68
71
|
_: TestResult[];
|
|
72
|
+
[x: string]: TestResult[];
|
|
69
73
|
}>;
|
|
70
74
|
testsStatistic(filter?: TestResultFilter): Promise<Statistic>;
|
|
71
75
|
allEnvironments(): Promise<string[]>;
|
|
76
|
+
allEnvironmentIdentities(): Promise<EnvironmentIdentity[]>;
|
|
72
77
|
testResultsByEnvironment(env: string, options?: {
|
|
73
|
-
includeHidden
|
|
78
|
+
includeHidden?: boolean;
|
|
79
|
+
}): Promise<TestResult[]>;
|
|
80
|
+
testResultsByEnvironmentId(envId: string, options?: {
|
|
81
|
+
includeHidden?: boolean;
|
|
74
82
|
}): Promise<TestResult[]>;
|
|
75
83
|
allTestEnvGroups(): Promise<TestEnvGroup[]>;
|
|
76
84
|
allVariables(): Promise<ReportVariables>;
|
|
77
85
|
envVariables(env: string): Promise<{
|
|
78
86
|
[x: string]: string;
|
|
79
87
|
}>;
|
|
88
|
+
envVariablesByEnvironmentId(envId: string): Promise<{
|
|
89
|
+
[x: string]: string;
|
|
90
|
+
}>;
|
|
80
91
|
dumpState(): AllureStoreDump;
|
|
81
92
|
restoreState(stateDump: AllureStoreDump, attachmentsContents?: Record<string, ResultFile>): Promise<void>;
|
|
82
93
|
}
|