@allurereport/core 3.17.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +1 -1
- package/dist/config.js +28 -12
- package/dist/history.d.ts +3 -0
- package/dist/history.js +47 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/qualityGate/qualityGate.d.ts +1 -0
- package/dist/qualityGate/qualityGate.js +19 -15
- package/dist/qualityGate/rules.js +20 -8
- package/dist/report.js +70 -15
- package/dist/resolutions.d.ts +8 -0
- package/dist/resolutions.js +23 -2
- package/dist/store/convert.d.ts +0 -1
- package/dist/store/convert.js +72 -58
- package/dist/store/retrySubstore.d.ts +1 -3
- package/dist/store/retrySubstore.js +0 -14
- package/dist/store/store.d.ts +4 -2
- package/dist/store/store.js +242 -189
- package/dist/utils/event.d.ts +21 -1
- package/dist/utils/event.js +30 -4
- package/dist/utils/flaky.d.ts +2 -2
- package/dist/utils/flaky.js +36 -8
- package/dist/utils/realtimeChannel.d.ts +1 -0
- package/dist/utils/realtimeChannel.js +2 -2
- package/package.json +22 -22
package/dist/report.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _AllureReport_instances, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_realtimeChannel, _AllureReport_realtimeUpdateScheduler, _AllureReport_realTime, _AllureReport_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_appendHistory, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_globalAttachments, _AllureReport_knownIssuesPath, _AllureReport_dumpTempDirs, _AllureReport_cwd, _AllureReport_state, _AllureReport_executionStage, _AllureReport_historyDataPoint, _AllureReport_summaryPath, _AllureReport_testResultsRegistryPath, _AllureReport_summariesByPluginId, _AllureReport_publishedRemoteHrefs, _AllureReport_artifactFilesByPath, _AllureReport_published, _AllureReport_endGeneratePerfSpan, _AllureReport_createHistoryDataPoint, _AllureReport_ingestSelfPerfMetrics, _AllureReport_publish, _AllureReport_getCwd, _AllureReport_runRealtimeUpdate, _AllureReport_recordArtifact, _AllureReport_restoreStateDumps, _AllureReport_getReportsToPublish, _AllureReport_cleanupFailedRemoteReport, _AllureReport_logPublishError, _AllureReport_applyPublishLinksToSummaries, _AllureReport_cloneSummariesByPluginId, _AllureReport_writeSummaryFiles, _AllureReport_writeTestResultRegistry, _AllureReport_getRootRemoteReportFiles, _AllureReport_writeQualityGateFiles, _AllureReport_finishArtifactsManifest, _AllureReport_generateRootSummary, _AllureReport_finishGeneratePerfSpan, _AllureReport_finishPerfMetrics, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
12
|
+
var _AllureReport_instances, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_realtimeChannel, _AllureReport_realtimeUpdateScheduler, _AllureReport_realTime, _AllureReport_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_historyBaseUrl, _AllureReport_appendHistory, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_globalAttachments, _AllureReport_knownIssuesPath, _AllureReport_dumpTempDirs, _AllureReport_cwd, _AllureReport_state, _AllureReport_executionStage, _AllureReport_historyDataPoint, _AllureReport_summaryPath, _AllureReport_testResultsRegistryPath, _AllureReport_summariesByPluginId, _AllureReport_publishedRemoteHrefs, _AllureReport_artifactFilesByPath, _AllureReport_published, _AllureReport_endGeneratePerfSpan, _AllureReport_resolveHistoryReportUrl, _AllureReport_createHistoryDataPoint, _AllureReport_ingestSelfPerfMetrics, _AllureReport_publish, _AllureReport_getCwd, _AllureReport_runRealtimeUpdate, _AllureReport_recordArtifact, _AllureReport_restoreStateDumps, _AllureReport_getReportsToPublish, _AllureReport_cleanupFailedRemoteReport, _AllureReport_logPublishError, _AllureReport_applyPublishLinksToSummaries, _AllureReport_cloneSummariesByPluginId, _AllureReport_writeSummaryFiles, _AllureReport_writeTestResultRegistry, _AllureReport_getRootRemoteReportFiles, _AllureReport_writeQualityGateFiles, _AllureReport_finishArtifactsManifest, _AllureReport_generateRootSummary, _AllureReport_finishGeneratePerfSpan, _AllureReport_finishPerfMetrics, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
13
13
|
import console from "node:console";
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
15
|
import { once } from "node:events";
|
|
@@ -20,7 +20,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
20
20
|
import { promisify } from "node:util";
|
|
21
21
|
import { detect } from "@allurereport/ci";
|
|
22
22
|
import { createProgressLogger } from "@allurereport/cli-commons";
|
|
23
|
-
import { normalizeCategoriesConfig } from "@allurereport/core-api";
|
|
23
|
+
import { normalizeCategoriesConfig, parseIntegerConfigValue } from "@allurereport/core-api";
|
|
24
24
|
import { AllureStoreDumpFiles, createTestResultRegistry, } from "@allurereport/plugin-api";
|
|
25
25
|
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
26
26
|
import { PathResultFile } from "@allurereport/reader-api";
|
|
@@ -30,7 +30,7 @@ import { glob } from "glob";
|
|
|
30
30
|
import ZipReadStream from "node-stream-zip";
|
|
31
31
|
import pLimit from "p-limit";
|
|
32
32
|
import ZipWriteStream from "zip-stream";
|
|
33
|
-
import { AllureLocalHistory, createHistory } from "./history.js";
|
|
33
|
+
import { AllureLocalHistory, createHistory, normalizeHistoryBaseUrl, setHistoryDataPointUrl } from "./history.js";
|
|
34
34
|
import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
35
35
|
import { QualityGate } from "./qualityGate/index.js";
|
|
36
36
|
import { writeKnownIssues } from "./resolutions.js";
|
|
@@ -45,6 +45,7 @@ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.me
|
|
|
45
45
|
const INIT_REQUIRED_ERROR_MESSAGE = "report is not initialised. Call the start() method first.";
|
|
46
46
|
const DEFAULT_READ_CONCURRENCY = 64;
|
|
47
47
|
const MAX_READ_CONCURRENCY = 256;
|
|
48
|
+
const DEFAULT_UPLOAD_CONCURRENCY = 10;
|
|
48
49
|
const TEST_RESULTS_REGISTRY_FILENAME = "test-results.json";
|
|
49
50
|
const QUALITY_GATE_RESULTS_FILENAME = "quality-gate.json";
|
|
50
51
|
const ROOT_INTEGRATION_FILENAMES = new Set([
|
|
@@ -66,6 +67,23 @@ const remoteReportParams = (ci) => {
|
|
|
66
67
|
return repo && branch ? { repo, branch } : {};
|
|
67
68
|
};
|
|
68
69
|
const errorDetails = (err) => (err instanceof Error ? (err.stack ?? err.message) : String(err));
|
|
70
|
+
const getExecutorReportUrl = (executor) => {
|
|
71
|
+
if (!executor || typeof executor !== "object" || !("reportUrl" in executor)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const { reportUrl } = executor;
|
|
75
|
+
if (typeof reportUrl !== "string") {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const navUrl = new URL(reportUrl);
|
|
80
|
+
navUrl.pathname = navUrl.pathname.endsWith("/") ? navUrl.pathname : `${navUrl.pathname}/`;
|
|
81
|
+
return navUrl.toString();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
69
87
|
const closeReadStream = async (stream) => {
|
|
70
88
|
if (stream.closed) {
|
|
71
89
|
return;
|
|
@@ -90,6 +108,7 @@ export class AllureReport {
|
|
|
90
108
|
_AllureReport_hideLabels.set(this, void 0);
|
|
91
109
|
_AllureReport_output.set(this, void 0);
|
|
92
110
|
_AllureReport_history.set(this, void 0);
|
|
111
|
+
_AllureReport_historyBaseUrl.set(this, void 0);
|
|
93
112
|
_AllureReport_appendHistory.set(this, void 0);
|
|
94
113
|
_AllureReport_allureServiceClient.set(this, void 0);
|
|
95
114
|
_AllureReport_qualityGate.set(this, void 0);
|
|
@@ -110,10 +129,22 @@ export class AllureReport {
|
|
|
110
129
|
_AllureReport_artifactFilesByPath.set(this, new Map());
|
|
111
130
|
_AllureReport_published.set(this, false);
|
|
112
131
|
_AllureReport_endGeneratePerfSpan.set(this, void 0);
|
|
132
|
+
_AllureReport_resolveHistoryReportUrl.set(this, async () => {
|
|
133
|
+
if (this.reportUrl) {
|
|
134
|
+
return this.reportUrl;
|
|
135
|
+
}
|
|
136
|
+
const executorReportUrl = getExecutorReportUrl(await __classPrivateFieldGet(this, _AllureReport_store, "f").metadataByKey("allure2_executor"));
|
|
137
|
+
if (executorReportUrl) {
|
|
138
|
+
this.reportUrl = executorReportUrl;
|
|
139
|
+
return executorReportUrl;
|
|
140
|
+
}
|
|
141
|
+
return "";
|
|
142
|
+
});
|
|
113
143
|
_AllureReport_createHistoryDataPoint.set(this, async () => {
|
|
114
144
|
const allTrs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
115
145
|
const allTcs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
116
|
-
|
|
146
|
+
const historyReportUrl = await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
|
|
147
|
+
return createHistory(this.reportUuid, this.reportName, allTcs, allTrs, historyReportUrl, await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics());
|
|
117
148
|
});
|
|
118
149
|
_AllureReport_ingestSelfPerfMetrics.set(this, async () => {
|
|
119
150
|
if (!isPerfMetricsEnabled()) {
|
|
@@ -268,6 +299,7 @@ export class AllureReport {
|
|
|
268
299
|
}
|
|
269
300
|
const resultsDirPath = resolve(resultsDir);
|
|
270
301
|
if (await readXcResultBundle(__classPrivateFieldGet(this, _AllureReport_store, "f"), resultsDirPath)) {
|
|
302
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
271
303
|
return;
|
|
272
304
|
}
|
|
273
305
|
try {
|
|
@@ -288,12 +320,14 @@ export class AllureReport {
|
|
|
288
320
|
catch (e) {
|
|
289
321
|
console.error("can't read directory", e);
|
|
290
322
|
}
|
|
323
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
291
324
|
});
|
|
292
325
|
this.readFile = async (resultsFile) => measurePerf(PERF_METRIC_NAMES.generateReadResults, async () => {
|
|
293
326
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
294
327
|
throw new Error(INIT_REQUIRED_ERROR_MESSAGE);
|
|
295
328
|
}
|
|
296
329
|
await this.readResult(new PathResultFile(resultsFile));
|
|
330
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
297
331
|
});
|
|
298
332
|
this.readResult = async (data) => {
|
|
299
333
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
@@ -314,6 +348,9 @@ export class AllureReport {
|
|
|
314
348
|
};
|
|
315
349
|
this.validate = async (params) => {
|
|
316
350
|
const { trs, state, environment } = params;
|
|
351
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "done") {
|
|
352
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags(trs.filter(Boolean));
|
|
353
|
+
}
|
|
317
354
|
const qualityGateEnvironment = environment === undefined
|
|
318
355
|
? undefined
|
|
319
356
|
: (environmentIdentityById(__classPrivateFieldGet(this, _AllureReport_environments, "f"), environment)?.name ??
|
|
@@ -339,6 +376,7 @@ export class AllureReport {
|
|
|
339
376
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "done") {
|
|
340
377
|
throw new Error("the report is already stopped, the restart isn't supported at the moment");
|
|
341
378
|
}
|
|
379
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
342
380
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "running", "f");
|
|
343
381
|
__classPrivateFieldSet(this, _AllureReport_endGeneratePerfSpan, startPerfSpan(PERF_METRIC_NAMES.generateTotal), "f");
|
|
344
382
|
if (__classPrivateFieldGet(this, _AllureReport_globalAttachments, "f")?.length) {
|
|
@@ -368,6 +406,7 @@ export class AllureReport {
|
|
|
368
406
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
369
407
|
return;
|
|
370
408
|
}
|
|
409
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
371
410
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
372
411
|
await plugin.update?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
373
412
|
});
|
|
@@ -418,7 +457,7 @@ export class AllureReport {
|
|
|
418
457
|
const addJsonDumpEntry = async (entryName, value) => {
|
|
419
458
|
await addRequiredDumpEntry(Buffer.from(JSON.stringify(value)), entryName);
|
|
420
459
|
};
|
|
421
|
-
const dumpJsonEntries = ({ testResults, testCases, fixtures, attachments, environments, reportVariables, checkResults = {}, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {},
|
|
460
|
+
const dumpJsonEntries = ({ testResults, testCases, fixtures, attachments, environments, reportVariables, checkResults = {}, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByRetryHash = {}, indexTestResultByTestCase = {}, indexTestResultByResolutionIssue = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, resolutionIssues = {}, qualityGateResults = [], testResultIdsIngestOrder = [], metrics = [], }) => [
|
|
422
461
|
[AllureStoreDumpFiles.TestResults, testResults],
|
|
423
462
|
[AllureStoreDumpFiles.TestCases, testCases],
|
|
424
463
|
[AllureStoreDumpFiles.Fixtures, fixtures],
|
|
@@ -430,7 +469,7 @@ export class AllureReport {
|
|
|
430
469
|
[AllureStoreDumpFiles.GlobalAttachments, globalAttachmentIds],
|
|
431
470
|
[AllureStoreDumpFiles.GlobalErrors, globalErrors],
|
|
432
471
|
[AllureStoreDumpFiles.IndexAttachmentsByTestResults, indexAttachmentByTestResult],
|
|
433
|
-
[AllureStoreDumpFiles.
|
|
472
|
+
[AllureStoreDumpFiles.IndexTestResultsByRetryHash, indexTestResultByRetryHash],
|
|
434
473
|
[AllureStoreDumpFiles.IndexTestResultsByTestCase, indexTestResultByTestCase],
|
|
435
474
|
[AllureStoreDumpFiles.IndexTestResultsByResolutionIssue, indexTestResultByResolutionIssue],
|
|
436
475
|
[AllureStoreDumpFiles.IndexAttachmentsByFixture, indexAttachmentByFixture],
|
|
@@ -506,6 +545,7 @@ export class AllureReport {
|
|
|
506
545
|
this.restoreState = async (dumps) => {
|
|
507
546
|
__classPrivateFieldGet(this, _AllureReport_store, "f").resetIngestOrder();
|
|
508
547
|
await __classPrivateFieldGet(this, _AllureReport_restoreStateDumps, "f").call(this, dumps.map((path) => ({ artifactPath: path, path })));
|
|
548
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
509
549
|
};
|
|
510
550
|
_AllureReport_recordArtifact.set(this, (filePath, name = basename(filePath)) => {
|
|
511
551
|
const artifact = createReportArtifact(filePath, __classPrivateFieldGet(this, _AllureReport_getCwd, "f").call(this), name);
|
|
@@ -576,8 +616,6 @@ export class AllureReport {
|
|
|
576
616
|
const globalAttachmentsEntry = await requiredEntryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
577
617
|
const globalErrorsEntry = await requiredEntryData(AllureStoreDumpFiles.GlobalErrors);
|
|
578
618
|
const indexAttachmentsEntry = await requiredEntryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
579
|
-
const indexTestResultsByHistoryId = await requiredEntryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
580
|
-
const indexTestResultsByTestCaseEntry = await requiredEntryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
581
619
|
const indexTestResultsByResolutionIssueEntry = await optionalEntryData(AllureStoreDumpFiles.IndexTestResultsByResolutionIssue);
|
|
582
620
|
const indexAttachmentsByFixtureEntry = await requiredEntryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
583
621
|
const indexFixturesByTestResultEntry = await requiredEntryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
@@ -599,7 +637,7 @@ export class AllureReport {
|
|
|
599
637
|
case AllureStoreDumpFiles.GlobalAttachments:
|
|
600
638
|
case AllureStoreDumpFiles.GlobalErrors:
|
|
601
639
|
case AllureStoreDumpFiles.IndexAttachmentsByTestResults:
|
|
602
|
-
case AllureStoreDumpFiles.
|
|
640
|
+
case AllureStoreDumpFiles.IndexTestResultsByRetryHash:
|
|
603
641
|
case AllureStoreDumpFiles.IndexTestResultsByTestCase:
|
|
604
642
|
case AllureStoreDumpFiles.IndexTestResultsByResolutionIssue:
|
|
605
643
|
case AllureStoreDumpFiles.IndexAttachmentsByFixture:
|
|
@@ -628,8 +666,8 @@ export class AllureReport {
|
|
|
628
666
|
globalAttachmentIds: JSON.parse(globalAttachmentsEntry.toString("utf8")),
|
|
629
667
|
globalErrors: JSON.parse(globalErrorsEntry.toString("utf8")),
|
|
630
668
|
indexAttachmentByTestResult: JSON.parse(indexAttachmentsEntry.toString("utf8")),
|
|
631
|
-
|
|
632
|
-
indexTestResultByTestCase:
|
|
669
|
+
indexTestResultByRetryHash: {},
|
|
670
|
+
indexTestResultByTestCase: {},
|
|
633
671
|
indexTestResultByResolutionIssue: indexTestResultsByResolutionIssueEntry
|
|
634
672
|
? JSON.parse(indexTestResultsByResolutionIssueEntry.toString("utf8"))
|
|
635
673
|
: {},
|
|
@@ -809,10 +847,12 @@ export class AllureReport {
|
|
|
809
847
|
console.error("realtime update failed during shutdown", e);
|
|
810
848
|
}
|
|
811
849
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
850
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
812
851
|
if (__classPrivateFieldGet(this, _AllureReport_dump, "f")) {
|
|
813
852
|
await this.dumpState();
|
|
814
853
|
return;
|
|
815
854
|
}
|
|
855
|
+
await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
|
|
816
856
|
await measurePerf(PERF_METRIC_NAMES.generatePluginsDone, async () => {
|
|
817
857
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
818
858
|
await measurePerf(`${PERF_METRIC_PREFIXES.generatePluginDone}${context.id}`, async () => {
|
|
@@ -853,7 +893,15 @@ export class AllureReport {
|
|
|
853
893
|
}
|
|
854
894
|
const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
|
|
855
895
|
const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
|
|
856
|
-
|
|
896
|
+
const shouldFlattenOutput = outputDirectoryEntries.length === 1;
|
|
897
|
+
if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
|
|
898
|
+
const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
|
|
899
|
+
if (shouldFlattenOutput) {
|
|
900
|
+
historyUrl.pathname = `${historyUrl.pathname}index.html`;
|
|
901
|
+
}
|
|
902
|
+
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, setHistoryDataPointUrl(__classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"), historyUrl.toString()), "f");
|
|
903
|
+
}
|
|
904
|
+
if (shouldFlattenOutput) {
|
|
857
905
|
const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"), outputDirectoryEntries[0].file);
|
|
858
906
|
const reportContent = await readdir(reportPath);
|
|
859
907
|
for (const entry of reportContent) {
|
|
@@ -965,12 +1013,13 @@ export class AllureReport {
|
|
|
965
1013
|
}
|
|
966
1014
|
}
|
|
967
1015
|
});
|
|
968
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], resolutions, reportFiles, realTime, historyPath, historyLimit, appendHistory, defaultLabels = {}, variables = {}, environment, allowedEnvironments, environments, output, hideLabels, qualityGate, performance, dump, categories, allureService, globalAttachments, cwd, } = opts;
|
|
1016
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], resolutions, reportFiles, realTime, historyPath, historyBaseUrl, historyLimit, flakyDetection, appendHistory, defaultLabels = {}, variables = {}, environment, allowedEnvironments, environments, output, hideLabels, qualityGate, performance, dump, categories, allureService, globalAttachments, cwd, } = opts;
|
|
969
1017
|
const allureServiceAccessToken = allureService?.accessToken;
|
|
970
1018
|
if (allureServiceAccessToken) {
|
|
971
1019
|
const allureServiceClientConfig = {
|
|
972
1020
|
...allureService,
|
|
973
1021
|
accessToken: allureServiceAccessToken,
|
|
1022
|
+
uploadConcurrency: parseIntegerConfigValue(allureService.uploadConcurrency, 1) ?? DEFAULT_UPLOAD_CONCURRENCY,
|
|
974
1023
|
};
|
|
975
1024
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceAccessToken.startsWith("ato1.")
|
|
976
1025
|
? new AllureTestOpsClient(allureServiceClientConfig)
|
|
@@ -983,7 +1032,11 @@ export class AllureReport {
|
|
|
983
1032
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
984
1033
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
985
1034
|
this.reportName = [name, reportTitleSuffix].filter(Boolean).join(" – ");
|
|
986
|
-
__classPrivateFieldSet(this, _AllureReport_realtimeChannel, new RealtimeChannel()
|
|
1035
|
+
__classPrivateFieldSet(this, _AllureReport_realtimeChannel, new RealtimeChannel(() => {
|
|
1036
|
+
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "running") {
|
|
1037
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").updateHistoryFlags();
|
|
1038
|
+
}
|
|
1039
|
+
}), "f");
|
|
987
1040
|
__classPrivateFieldSet(this, _AllureReport_realtimeUpdateScheduler, new RealtimeUpdateScheduler(__classPrivateFieldGet(this, _AllureReport_runRealtimeUpdate, "f")), "f");
|
|
988
1041
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
989
1042
|
__classPrivateFieldSet(this, _AllureReport_dump, dump, "f");
|
|
@@ -996,6 +1049,7 @@ export class AllureReport {
|
|
|
996
1049
|
__classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
|
|
997
1050
|
}
|
|
998
1051
|
__classPrivateFieldSet(this, _AllureReport_categories, normalizeCategoriesConfig(categories), "f");
|
|
1052
|
+
__classPrivateFieldSet(this, _AllureReport_historyBaseUrl, !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && historyPath && historyBaseUrl ? normalizeHistoryBaseUrl(historyBaseUrl) : undefined, "f");
|
|
999
1053
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
1000
1054
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
1001
1055
|
limit: historyLimit,
|
|
@@ -1015,6 +1069,7 @@ export class AllureReport {
|
|
|
1015
1069
|
reportVariables: variables,
|
|
1016
1070
|
environmentsConfig: environments,
|
|
1017
1071
|
history: __classPrivateFieldGet(this, _AllureReport_history, "f"),
|
|
1072
|
+
flakyDetection,
|
|
1018
1073
|
resolutionsConfig: resolutions,
|
|
1019
1074
|
defaultLabels,
|
|
1020
1075
|
environment,
|
|
@@ -1039,6 +1094,6 @@ export class AllureReport {
|
|
|
1039
1094
|
return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
|
|
1040
1095
|
}
|
|
1041
1096
|
}
|
|
1042
|
-
_AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_realtimeChannel = new WeakMap(), _AllureReport_realtimeUpdateScheduler = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_hideLabels = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_appendHistory = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_environments = new WeakMap(), _AllureReport_globalAttachments = new WeakMap(), _AllureReport_knownIssuesPath = new WeakMap(), _AllureReport_dumpTempDirs = new WeakMap(), _AllureReport_cwd = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_historyDataPoint = new WeakMap(), _AllureReport_summaryPath = new WeakMap(), _AllureReport_testResultsRegistryPath = new WeakMap(), _AllureReport_summariesByPluginId = new WeakMap(), _AllureReport_publishedRemoteHrefs = new WeakMap(), _AllureReport_artifactFilesByPath = new WeakMap(), _AllureReport_published = new WeakMap(), _AllureReport_endGeneratePerfSpan = new WeakMap(), _AllureReport_createHistoryDataPoint = new WeakMap(), _AllureReport_ingestSelfPerfMetrics = new WeakMap(), _AllureReport_publish = new WeakMap(), _AllureReport_getCwd = new WeakMap(), _AllureReport_runRealtimeUpdate = new WeakMap(), _AllureReport_recordArtifact = new WeakMap(), _AllureReport_restoreStateDumps = new WeakMap(), _AllureReport_getReportsToPublish = new WeakMap(), _AllureReport_cleanupFailedRemoteReport = new WeakMap(), _AllureReport_logPublishError = new WeakMap(), _AllureReport_applyPublishLinksToSummaries = new WeakMap(), _AllureReport_cloneSummariesByPluginId = new WeakMap(), _AllureReport_writeSummaryFiles = new WeakMap(), _AllureReport_writeTestResultRegistry = new WeakMap(), _AllureReport_getRootRemoteReportFiles = new WeakMap(), _AllureReport_writeQualityGateFiles = new WeakMap(), _AllureReport_finishArtifactsManifest = new WeakMap(), _AllureReport_generateRootSummary = new WeakMap(), _AllureReport_finishGeneratePerfSpan = new WeakMap(), _AllureReport_finishPerfMetrics = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
1097
|
+
_AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_realtimeChannel = new WeakMap(), _AllureReport_realtimeUpdateScheduler = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_hideLabels = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_historyBaseUrl = new WeakMap(), _AllureReport_appendHistory = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_environments = new WeakMap(), _AllureReport_globalAttachments = new WeakMap(), _AllureReport_knownIssuesPath = new WeakMap(), _AllureReport_dumpTempDirs = new WeakMap(), _AllureReport_cwd = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_historyDataPoint = new WeakMap(), _AllureReport_summaryPath = new WeakMap(), _AllureReport_testResultsRegistryPath = new WeakMap(), _AllureReport_summariesByPluginId = new WeakMap(), _AllureReport_publishedRemoteHrefs = new WeakMap(), _AllureReport_artifactFilesByPath = new WeakMap(), _AllureReport_published = new WeakMap(), _AllureReport_endGeneratePerfSpan = new WeakMap(), _AllureReport_resolveHistoryReportUrl = new WeakMap(), _AllureReport_createHistoryDataPoint = new WeakMap(), _AllureReport_ingestSelfPerfMetrics = new WeakMap(), _AllureReport_publish = new WeakMap(), _AllureReport_getCwd = new WeakMap(), _AllureReport_runRealtimeUpdate = new WeakMap(), _AllureReport_recordArtifact = new WeakMap(), _AllureReport_restoreStateDumps = new WeakMap(), _AllureReport_getReportsToPublish = new WeakMap(), _AllureReport_cleanupFailedRemoteReport = new WeakMap(), _AllureReport_logPublishError = new WeakMap(), _AllureReport_applyPublishLinksToSummaries = new WeakMap(), _AllureReport_cloneSummariesByPluginId = new WeakMap(), _AllureReport_writeSummaryFiles = new WeakMap(), _AllureReport_writeTestResultRegistry = new WeakMap(), _AllureReport_getRootRemoteReportFiles = new WeakMap(), _AllureReport_writeQualityGateFiles = new WeakMap(), _AllureReport_finishArtifactsManifest = new WeakMap(), _AllureReport_generateRootSummary = new WeakMap(), _AllureReport_finishGeneratePerfSpan = new WeakMap(), _AllureReport_finishPerfMetrics = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
1043
1098
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
|
1044
1099
|
};
|
package/dist/resolutions.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { ResolutionRule, ResolutionsConfig, TestResult } from "@allurerepor
|
|
|
2
2
|
import type { AllureStore } from "@allurereport/plugin-api";
|
|
3
3
|
export declare const DEFAULT_KNOWN_ISSUES_PATH = "known-issues.json";
|
|
4
4
|
export declare const validateResolutionsConfig: (config?: ResolutionsConfig) => void;
|
|
5
|
+
export declare const MUTED_FROM_RESULT_RESOLUTION: {
|
|
6
|
+
readonly resolution: "muted";
|
|
7
|
+
readonly comment: "Muted from result";
|
|
8
|
+
};
|
|
9
|
+
export declare const KNOWN_FROM_RESULT_RESOLUTION: {
|
|
10
|
+
readonly resolution: "accepted";
|
|
11
|
+
readonly comment: "Accepted from result (known)";
|
|
12
|
+
};
|
|
5
13
|
export declare const getResolutionByRules: (testResult: TestResult, config?: ResolutionsConfig) => ResolutionRule | undefined;
|
|
6
14
|
export declare const isIgnoredFailure: (testResult: TestResult) => boolean;
|
|
7
15
|
export declare const resolveExactIssuesFilePath: (pathOrDir: string | undefined, label: string) => Promise<string | undefined>;
|
package/dist/resolutions.js
CHANGED
|
@@ -121,11 +121,32 @@ const matches = (rule, testResult) => {
|
|
|
121
121
|
(!rule.retryHash || (!!testResult.retryHash && rule.retryHash.includes(testResult.retryHash))) &&
|
|
122
122
|
(!rule.environment || (!!testResult.environment && rule.environment.includes(testResult.environment))));
|
|
123
123
|
};
|
|
124
|
+
export const MUTED_FROM_RESULT_RESOLUTION = {
|
|
125
|
+
resolution: "muted",
|
|
126
|
+
comment: "Muted from result",
|
|
127
|
+
};
|
|
128
|
+
export const KNOWN_FROM_RESULT_RESOLUTION = {
|
|
129
|
+
resolution: "accepted",
|
|
130
|
+
comment: "Accepted from result (known)",
|
|
131
|
+
};
|
|
124
132
|
export const getResolutionByRules = (testResult, config) => {
|
|
125
|
-
if (
|
|
133
|
+
if (testResult.status !== "failed" && testResult.status !== "broken") {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const issueRule = config?.rules.find((candidate) => candidate.resolution === "issue" && matches(candidate, testResult));
|
|
137
|
+
if (issueRule) {
|
|
138
|
+
return issueRule;
|
|
139
|
+
}
|
|
140
|
+
if (testResult.muted) {
|
|
141
|
+
return MUTED_FROM_RESULT_RESOLUTION;
|
|
142
|
+
}
|
|
143
|
+
if (testResult.known) {
|
|
144
|
+
return KNOWN_FROM_RESULT_RESOLUTION;
|
|
145
|
+
}
|
|
146
|
+
if (!config?.rules.length) {
|
|
126
147
|
return undefined;
|
|
127
148
|
}
|
|
128
|
-
for (const resolution of ["
|
|
149
|
+
for (const resolution of ["muted", "accepted"]) {
|
|
129
150
|
const rule = config.rules.find((candidate) => candidate.resolution === resolution && matches(candidate, testResult));
|
|
130
151
|
if (rule) {
|
|
131
152
|
return rule;
|
package/dist/store/convert.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AttachmentLink, TestCase, TestFixtureResult, TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { RawFixtureResult, RawTestResult, ReaderContext } from "@allurereport/reader-api";
|
|
3
|
-
export declare const __unknown = "#___unknown_value___#";
|
|
4
3
|
export type StateData = {
|
|
5
4
|
testCases: Map<string, TestCase>;
|
|
6
5
|
attachments: Map<string, AttachmentLink>;
|
package/dist/store/convert.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { findByLabelName, notNull } from "@allurereport/core-api";
|
|
2
|
+
import { UNKNOWN_PARAMETER_VALUE, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, findByLabelName, notNull, } from "@allurereport/core-api";
|
|
3
3
|
import { md5 } from "@allurereport/plugin-api";
|
|
4
4
|
import { extension, lookupContentType } from "@allurereport/reader-api";
|
|
5
5
|
const defaultStatus = "unknown";
|
|
6
|
-
|
|
6
|
+
const convertRawError = (raw) => ({
|
|
7
|
+
message: raw.message,
|
|
8
|
+
trace: raw.trace,
|
|
9
|
+
...(raw.actual && raw.expected ? { expected: raw.expected, actual: raw.actual } : {}),
|
|
10
|
+
});
|
|
11
|
+
const convertTestErrors = (raw) => {
|
|
12
|
+
const errors = raw.errors?.filter(notNull);
|
|
13
|
+
if (errors?.length) {
|
|
14
|
+
return errors.map(convertRawError);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
7
17
|
export const testFixtureResultRawToState = (stateData, raw, context) => {
|
|
8
18
|
const name = raw.name || "Unknown test";
|
|
9
19
|
return {
|
|
@@ -26,24 +36,32 @@ export const testFixtureResultRawToState = (stateData, raw, context) => {
|
|
|
26
36
|
};
|
|
27
37
|
};
|
|
28
38
|
export const testResultRawToState = (stateData, raw, context) => {
|
|
39
|
+
const legacyTestCaseHash = calculateLegacyTestCaseHash(raw);
|
|
40
|
+
const allureId = raw.labels
|
|
41
|
+
?.find((label) => (label?.name === "ALLURE_ID" || label?.name === "AS_ID") && label.value?.trim())
|
|
42
|
+
?.value?.trim();
|
|
29
43
|
const labels = convertLabels(raw.labels);
|
|
30
44
|
const hostId = findByLabelName(labels, "host");
|
|
31
45
|
const threadId = findByLabelName(labels, "thread");
|
|
32
46
|
const name = raw.name || "Unknown test";
|
|
33
|
-
const testCase = processTestCase(stateData, raw);
|
|
34
47
|
const parameters = convertParameters(raw.parameters);
|
|
48
|
+
const error = convertRawError(raw);
|
|
49
|
+
const errors = convertTestErrors(raw);
|
|
50
|
+
const testCaseHash = calculateTestCaseHash(raw.testId, raw.fullName);
|
|
51
|
+
const parametersHash = calculateParametersHash(parameters);
|
|
52
|
+
const testCase = processTestCase({ stateData, raw, allureId, testCaseHash });
|
|
35
53
|
return {
|
|
36
54
|
id: md5(raw.uuid || randomUUID()),
|
|
37
55
|
name,
|
|
38
56
|
testCase,
|
|
39
57
|
fullName: raw.fullName,
|
|
40
|
-
|
|
58
|
+
testCaseHash,
|
|
59
|
+
parametersHash,
|
|
60
|
+
environmentHash: null,
|
|
61
|
+
retryHash: calculateRetryHash({ testCaseHash, parametersHash }),
|
|
41
62
|
status: raw.status ?? defaultStatus,
|
|
42
|
-
error:
|
|
43
|
-
|
|
44
|
-
trace: raw.trace,
|
|
45
|
-
...(raw.actual && raw.expected ? { expected: raw.expected, actual: raw.actual } : {}),
|
|
46
|
-
},
|
|
63
|
+
error: errors?.[0] ?? error,
|
|
64
|
+
errors,
|
|
47
65
|
...processTimings(raw),
|
|
48
66
|
description: raw.description,
|
|
49
67
|
descriptionHtml: raw.descriptionHtml,
|
|
@@ -53,6 +71,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
53
71
|
expectedResultHtml: raw.expectedResultHtml,
|
|
54
72
|
flaky: raw.flaky ?? false,
|
|
55
73
|
muted: raw.muted ?? false,
|
|
74
|
+
known: raw.known ?? false,
|
|
56
75
|
isRetry: false,
|
|
57
76
|
labels,
|
|
58
77
|
steps: convertSteps(stateData, raw.steps).convertedSteps,
|
|
@@ -63,25 +82,43 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
63
82
|
sourceMetadata: {
|
|
64
83
|
readerId: context.readerId,
|
|
65
84
|
metadata: context.metadata ?? {},
|
|
85
|
+
legacyHistoryId: raw.historyId?.length ? raw.historyId : undefined,
|
|
86
|
+
reportedFlaky: raw.flaky ?? false,
|
|
87
|
+
legacyTestCaseHash,
|
|
66
88
|
},
|
|
67
89
|
titlePath: raw.titlePath ?? [],
|
|
68
90
|
};
|
|
69
91
|
};
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
|
|
92
|
+
const calculateLegacyTestCaseHash = (raw) => {
|
|
93
|
+
const maybeAllureId = raw.labels?.find((label) => (label?.name === "ALLURE_ID" || label?.name === "AS_ID") && label.value !== "-1")?.value;
|
|
94
|
+
if (maybeAllureId) {
|
|
95
|
+
return md5(`ALLURE_ID=${maybeAllureId}`);
|
|
96
|
+
}
|
|
97
|
+
if (raw.testId) {
|
|
98
|
+
return md5(raw.testId);
|
|
99
|
+
}
|
|
100
|
+
if (raw.fullName) {
|
|
101
|
+
return md5(raw.fullName);
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
};
|
|
105
|
+
const processTestCase = ({ stateData: { testCases }, raw, allureId, testCaseHash, }) => {
|
|
106
|
+
if (testCaseHash) {
|
|
107
|
+
const maybeTestCase = testCases.get(testCaseHash);
|
|
74
108
|
if (maybeTestCase) {
|
|
109
|
+
if (!maybeTestCase.allureId && allureId) {
|
|
110
|
+
maybeTestCase.allureId = allureId;
|
|
111
|
+
}
|
|
75
112
|
return maybeTestCase;
|
|
76
113
|
}
|
|
77
114
|
const testCase = {
|
|
78
|
-
id,
|
|
115
|
+
id: testCaseHash,
|
|
79
116
|
allureId,
|
|
80
117
|
externalId: raw.testId,
|
|
81
|
-
name: raw.testCaseName ?? raw.name ??
|
|
118
|
+
name: raw.testCaseName ?? raw.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
82
119
|
fullName: raw.fullName,
|
|
83
120
|
};
|
|
84
|
-
testCases.set(
|
|
121
|
+
testCases.set(testCaseHash, testCase);
|
|
85
122
|
return testCase;
|
|
86
123
|
}
|
|
87
124
|
return undefined;
|
|
@@ -99,7 +136,7 @@ const processAttachmentLink = ({ attachments, visitAttachmentLink }, attach) =>
|
|
|
99
136
|
originalFileName: undefined,
|
|
100
137
|
contentType: attach.contentType,
|
|
101
138
|
ext: "",
|
|
102
|
-
name: attach.name ??
|
|
139
|
+
name: attach.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
103
140
|
missed: true,
|
|
104
141
|
used: true,
|
|
105
142
|
});
|
|
@@ -127,7 +164,7 @@ const processAttachmentLink = ({ attachments, visitAttachmentLink }, attach) =>
|
|
|
127
164
|
id: randomUUID(),
|
|
128
165
|
originalFileName: undefined,
|
|
129
166
|
ext: "",
|
|
130
|
-
name: attach.name ?? attach.originalFileName ??
|
|
167
|
+
name: attach.name ?? attach.originalFileName ?? UNKNOWN_PARAMETER_VALUE,
|
|
131
168
|
contentType: attach.contentType,
|
|
132
169
|
missed: true,
|
|
133
170
|
used: true,
|
|
@@ -164,11 +201,11 @@ const processTimings = ({ start, stop, duration, }) => {
|
|
|
164
201
|
return { start: undefined, stop: undefined, duration };
|
|
165
202
|
};
|
|
166
203
|
const convertLabels = (labels) => {
|
|
167
|
-
return labels?.filter(notNull)?.map(convertLabel)?.flatMap(processTagLabels) ?? [];
|
|
204
|
+
return labels?.filter(notNull)?.map(convertLabel)?.flatMap(processTagLabels).map(normalizeAllureIdLabel) ?? [];
|
|
168
205
|
};
|
|
169
206
|
const convertLabel = (label) => {
|
|
170
207
|
return {
|
|
171
|
-
name: label.name ??
|
|
208
|
+
name: label.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
172
209
|
value: label.value,
|
|
173
210
|
};
|
|
174
211
|
};
|
|
@@ -195,7 +232,7 @@ const convertStep = (stateData, step) => {
|
|
|
195
232
|
return {
|
|
196
233
|
convertedStep: {
|
|
197
234
|
stepId: md5(`${step.name}${step.start}`),
|
|
198
|
-
name: step.name ??
|
|
235
|
+
name: step.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
199
236
|
status: step.status ?? defaultStatus,
|
|
200
237
|
steps: subSteps,
|
|
201
238
|
parameters: convertParameters(step.parameters),
|
|
@@ -216,11 +253,11 @@ const convertStep = (stateData, step) => {
|
|
|
216
253
|
};
|
|
217
254
|
const convertParameters = (parameters) => parameters
|
|
218
255
|
?.filter(notNull)
|
|
219
|
-
?.filter((p) => p.name)
|
|
256
|
+
?.filter((p) => typeof p.name === "string" && p.name.length > 0)
|
|
220
257
|
?.map(convertParameter) ?? [];
|
|
221
258
|
const convertParameter = (param) => ({
|
|
222
|
-
name: param.name ??
|
|
223
|
-
value: param.value ??
|
|
259
|
+
name: param.name ?? UNKNOWN_PARAMETER_VALUE,
|
|
260
|
+
value: param.value ?? UNKNOWN_PARAMETER_VALUE,
|
|
224
261
|
hidden: param.hidden ?? false,
|
|
225
262
|
excluded: param.excluded ?? false,
|
|
226
263
|
masked: param.masked ?? false,
|
|
@@ -231,42 +268,9 @@ const convertLinks = (links) => links
|
|
|
231
268
|
?.map(convertLink) ?? [];
|
|
232
269
|
const convertLink = (link) => ({
|
|
233
270
|
name: link.name,
|
|
234
|
-
url: link.url ??
|
|
271
|
+
url: link.url ?? UNKNOWN_PARAMETER_VALUE,
|
|
235
272
|
type: link.type,
|
|
236
273
|
});
|
|
237
|
-
const calculateTestId = (raw) => {
|
|
238
|
-
const maybeAllureId = raw.labels?.find((label) => (label.name === "ALLURE_ID" || label.name === "AS_ID") && label.value !== "-1")?.value;
|
|
239
|
-
if (maybeAllureId) {
|
|
240
|
-
return [md5(`ALLURE_ID=${maybeAllureId}`), maybeAllureId];
|
|
241
|
-
}
|
|
242
|
-
if (raw.testId) {
|
|
243
|
-
return [md5(raw.testId), undefined];
|
|
244
|
-
}
|
|
245
|
-
if (raw.fullName) {
|
|
246
|
-
return [md5(raw.fullName), undefined];
|
|
247
|
-
}
|
|
248
|
-
return [undefined, undefined];
|
|
249
|
-
};
|
|
250
|
-
const calculateHistoryId = (testCase, parameters) => {
|
|
251
|
-
if (!testCase) {
|
|
252
|
-
return undefined;
|
|
253
|
-
}
|
|
254
|
-
const paramsPart = stringifyParams(parameters);
|
|
255
|
-
return `${testCase.id}.${md5(paramsPart)}`;
|
|
256
|
-
};
|
|
257
|
-
const parametersCompare = (a, b) => {
|
|
258
|
-
return (a.name ?? "").localeCompare(b.name) || a.value.localeCompare(b.value ?? "");
|
|
259
|
-
};
|
|
260
|
-
const stringifyParams = (parameters) => {
|
|
261
|
-
if (!parameters) {
|
|
262
|
-
return "";
|
|
263
|
-
}
|
|
264
|
-
return parameters
|
|
265
|
-
.filter((p) => !p?.excluded)
|
|
266
|
-
.sort(parametersCompare)
|
|
267
|
-
.map((p) => `${p.name}:${p.value}`)
|
|
268
|
-
.join(",");
|
|
269
|
-
};
|
|
270
274
|
const idLabelMatcher = new RegExp("^@?allure\\.id[:=](?<id>.+)$");
|
|
271
275
|
const tagLabelMatcher = new RegExp("^@?allure\\.label\\.(?<name>.+)[:=](?<value>.+)$");
|
|
272
276
|
const processTagLabels = (label) => {
|
|
@@ -285,3 +289,13 @@ const processTagLabels = (label) => {
|
|
|
285
289
|
}
|
|
286
290
|
return label.name ? [{ name: label.name, value: label.value }] : [];
|
|
287
291
|
};
|
|
292
|
+
const normalizeAllureIdLabel = (label) => {
|
|
293
|
+
if (label.name !== "ALLURE_ID" && label.name !== "AS_ID") {
|
|
294
|
+
return label;
|
|
295
|
+
}
|
|
296
|
+
const value = label.value?.trim();
|
|
297
|
+
return {
|
|
298
|
+
name: "ALLURE_ID",
|
|
299
|
+
value: value?.length ? value : undefined,
|
|
300
|
+
};
|
|
301
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const calculateParametersHash: (parameters?: TestParameter[]) => string;
|
|
3
|
-
export declare const calculateRetryHash: (testCaseId: string | undefined, parametersHash: string, environmentId: string | undefined) => string | undefined;
|
|
1
|
+
import type { TestResult } from "@allurereport/core-api";
|
|
4
2
|
export declare class RetrySubstore {
|
|
5
3
|
#private;
|
|
6
4
|
recordIngestOrder(testResultId: string): void;
|
|
@@ -4,21 +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 _RetrySubstore_instances, _RetrySubstore_testResultsByRetryHash, _RetrySubstore_testResultIngestIndexById, _RetrySubstore_getIngestIndex, _RetrySubstore_compareResults;
|
|
7
|
-
import { md5 } from "../utils/crypto.js";
|
|
8
7
|
const NO_RETRIES = [];
|
|
9
|
-
const compareByNameThenValue = (first, second) => first.name.localeCompare(second.name) || first.value.localeCompare(second.value);
|
|
10
|
-
const stringifyRetryParameters = (parameters = []) => parameters
|
|
11
|
-
.filter((parameter) => !parameter.excluded)
|
|
12
|
-
.sort(compareByNameThenValue)
|
|
13
|
-
.map((parameter) => `${parameter.name}:${parameter.value}`)
|
|
14
|
-
.join(",");
|
|
15
|
-
export const calculateParametersHash = (parameters = []) => md5(stringifyRetryParameters(parameters));
|
|
16
|
-
export const calculateRetryHash = (testCaseId, parametersHash, environmentId) => {
|
|
17
|
-
if (!testCaseId) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
return md5(`${testCaseId}:${parametersHash}:${environmentId ?? "default"}`);
|
|
21
|
-
};
|
|
22
8
|
export class RetrySubstore {
|
|
23
9
|
constructor() {
|
|
24
10
|
_RetrySubstore_instances.add(this);
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AllureCheckResult, type AllureHistory, type AllurePerformanceResult, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type GlobalAttachmentLink, type HistoryDataPoint, type HistoryTestResult, type ResolutionIssue, type ResolutionsConfig, type MetricSample, type PerformanceConfig, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
1
|
+
import { type AllureCheckResult, type AllureHistory, type AllurePerformanceResult, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type FlakyDetectionConfig, type GlobalAttachmentLink, type HistoryDataPoint, type HistoryTestResult, type ResolutionIssue, type ResolutionsConfig, type MetricSample, type PerformanceConfig, 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 PluginGlobalError, 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>;
|
|
@@ -7,12 +7,13 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
7
7
|
#private;
|
|
8
8
|
readonly indexTestResultByTestCase: Map<string, TestResult[]>;
|
|
9
9
|
readonly indexTestResultByEnvironmentId: Map<string, TestResult[]>;
|
|
10
|
-
readonly
|
|
10
|
+
readonly indexTestResultByRetryHash: Map<string, TestResult[]>;
|
|
11
11
|
readonly indexAttachmentByTestResult: Map<string, AttachmentLink[]>;
|
|
12
12
|
readonly indexAttachmentByFixture: Map<string, AttachmentLink[]>;
|
|
13
13
|
readonly indexFixturesByTestResult: Map<string, TestFixtureResult[]>;
|
|
14
14
|
constructor(params?: {
|
|
15
15
|
history?: AllureHistory;
|
|
16
|
+
flakyDetection?: FlakyDetectionConfig;
|
|
16
17
|
resolutionsConfig?: ResolutionsConfig;
|
|
17
18
|
realtimeDispatcher?: RealtimeEventsDispatcher;
|
|
18
19
|
realtimeSubscriber?: RealtimeSubscriber;
|
|
@@ -24,6 +25,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
24
25
|
performance?: PerformanceConfig;
|
|
25
26
|
});
|
|
26
27
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
28
|
+
updateHistoryFlags(testResults?: Iterable<TestResult>): void;
|
|
27
29
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
28
30
|
addCheckResult(result: AllureCheckResult): Promise<void>;
|
|
29
31
|
allCheckResults(): Promise<AllureCheckResult[]>;
|