@allurereport/core 3.16.1 → 3.18.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 +3 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +18 -13
- package/dist/history.d.ts +5 -2
- package/dist/history.js +53 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/qualityGate/qualityGate.d.ts +7 -4
- package/dist/qualityGate/qualityGate.js +21 -15
- package/dist/qualityGate/rules.d.ts +13 -8
- package/dist/qualityGate/rules.js +149 -12
- package/dist/report.js +156 -40
- package/dist/resolutions.d.ts +8 -0
- package/dist/resolutions.js +23 -2
- package/dist/store/convert.js +1 -0
- package/dist/store/store.d.ts +4 -1
- package/dist/store/store.js +118 -41
- package/dist/utils/artifacts.d.ts +14 -0
- package/dist/utils/artifacts.js +35 -0
- package/dist/utils/event.d.ts +20 -0
- package/dist/utils/event.js +21 -0
- package/dist/utils/perf.d.ts +6 -10
- package/dist/utils/perf.js +41 -28
- package/package.json +22 -22
package/dist/report.js
CHANGED
|
@@ -9,18 +9,18 @@ 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_state, _AllureReport_executionStage, _AllureReport_historyDataPoint, _AllureReport_summaryPath, _AllureReport_testResultsRegistryPath, _AllureReport_summariesByPluginId, _AllureReport_publishedRemoteHrefs, _AllureReport_published, _AllureReport_endGeneratePerfSpan, _AllureReport_publish, _AllureReport_runRealtimeUpdate, _AllureReport_restoreStateDumps, _AllureReport_getReportsToPublish, _AllureReport_cleanupFailedRemoteReport, _AllureReport_logPublishError, _AllureReport_applyPublishLinksToSummaries, _AllureReport_cloneSummariesByPluginId, _AllureReport_writeSummaryFiles, _AllureReport_writeTestResultRegistry, _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";
|
|
16
16
|
import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
|
|
17
17
|
import { lstat, mkdtemp, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
18
18
|
import { tmpdir } from "node:os";
|
|
19
|
-
import { basename, dirname, join, resolve
|
|
19
|
+
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,13 +30,14 @@ 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";
|
|
37
37
|
import { DefaultAllureStore } from "./store/store.js";
|
|
38
|
+
import { ARTIFACTS_MANIFEST_FILENAME, createReportArtifact, deduplicateDumpInputs, } from "./utils/artifacts.js";
|
|
38
39
|
import { environmentIdentityById, environmentIdentityByName } from "./utils/environment.js";
|
|
39
|
-
import { measurePerf, PERF_METRIC_NAMES, PERF_METRIC_PREFIXES, startPerfSpan, writePerfMetrics } from "./utils/perf.js";
|
|
40
|
+
import { getPerfMetricsResults, isPerfMetricsEnabled, measurePerf, PERF_METRIC_NAMES, PERF_METRIC_PREFIXES, perfMetricsFileName, startPerfSpan, writePerfMetrics, } from "./utils/perf.js";
|
|
40
41
|
import { RealtimeChannel } from "./utils/realtimeChannel.js";
|
|
41
42
|
import { RealtimeUpdateScheduler } from "./utils/realtimeUpdateScheduler.js";
|
|
42
43
|
import { resolveDumpAttachmentPath, UnsafeDumpPathError } from "./utils/safeDumpPath.js";
|
|
@@ -44,7 +45,14 @@ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.me
|
|
|
44
45
|
const INIT_REQUIRED_ERROR_MESSAGE = "report is not initialised. Call the start() method first.";
|
|
45
46
|
const DEFAULT_READ_CONCURRENCY = 64;
|
|
46
47
|
const MAX_READ_CONCURRENCY = 256;
|
|
48
|
+
const DEFAULT_UPLOAD_CONCURRENCY = 10;
|
|
47
49
|
const TEST_RESULTS_REGISTRY_FILENAME = "test-results.json";
|
|
50
|
+
const QUALITY_GATE_RESULTS_FILENAME = "quality-gate.json";
|
|
51
|
+
const ROOT_INTEGRATION_FILENAMES = new Set([
|
|
52
|
+
TEST_RESULTS_REGISTRY_FILENAME,
|
|
53
|
+
QUALITY_GATE_RESULTS_FILENAME,
|
|
54
|
+
ARTIFACTS_MANIFEST_FILENAME,
|
|
55
|
+
]);
|
|
48
56
|
const readConcurrency = () => {
|
|
49
57
|
const parsed = Number.parseInt(process.env.ALLURE_READ_CONCURRENCY ?? "", 10);
|
|
50
58
|
if (!Number.isFinite(parsed)) {
|
|
@@ -59,6 +67,23 @@ const remoteReportParams = (ci) => {
|
|
|
59
67
|
return repo && branch ? { repo, branch } : {};
|
|
60
68
|
};
|
|
61
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
|
+
};
|
|
62
87
|
const closeReadStream = async (stream) => {
|
|
63
88
|
if (stream.closed) {
|
|
64
89
|
return;
|
|
@@ -83,6 +108,7 @@ export class AllureReport {
|
|
|
83
108
|
_AllureReport_hideLabels.set(this, void 0);
|
|
84
109
|
_AllureReport_output.set(this, void 0);
|
|
85
110
|
_AllureReport_history.set(this, void 0);
|
|
111
|
+
_AllureReport_historyBaseUrl.set(this, void 0);
|
|
86
112
|
_AllureReport_appendHistory.set(this, void 0);
|
|
87
113
|
_AllureReport_allureServiceClient.set(this, void 0);
|
|
88
114
|
_AllureReport_qualityGate.set(this, void 0);
|
|
@@ -92,6 +118,7 @@ export class AllureReport {
|
|
|
92
118
|
_AllureReport_globalAttachments.set(this, void 0);
|
|
93
119
|
_AllureReport_knownIssuesPath.set(this, void 0);
|
|
94
120
|
_AllureReport_dumpTempDirs.set(this, []);
|
|
121
|
+
_AllureReport_cwd.set(this, void 0);
|
|
95
122
|
_AllureReport_state.set(this, void 0);
|
|
96
123
|
_AllureReport_executionStage.set(this, "init");
|
|
97
124
|
_AllureReport_historyDataPoint.set(this, void 0);
|
|
@@ -99,8 +126,40 @@ export class AllureReport {
|
|
|
99
126
|
_AllureReport_testResultsRegistryPath.set(this, void 0);
|
|
100
127
|
_AllureReport_summariesByPluginId.set(this, new Map());
|
|
101
128
|
_AllureReport_publishedRemoteHrefs.set(this, new Set());
|
|
129
|
+
_AllureReport_artifactFilesByPath.set(this, new Map());
|
|
102
130
|
_AllureReport_published.set(this, false);
|
|
103
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
|
+
});
|
|
143
|
+
_AllureReport_createHistoryDataPoint.set(this, async () => {
|
|
144
|
+
const allTrs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
145
|
+
const allTcs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
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());
|
|
148
|
+
});
|
|
149
|
+
_AllureReport_ingestSelfPerfMetrics.set(this, async () => {
|
|
150
|
+
if (!isPerfMetricsEnabled()) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const results = getPerfMetricsResults();
|
|
154
|
+
if (results.length === 0) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const originalFileName = perfMetricsFileName(this.reportUuid);
|
|
158
|
+
await __classPrivateFieldGet(this, _AllureReport_store, "f").visitMetrics(results, {
|
|
159
|
+
readerId: "api",
|
|
160
|
+
metadata: { originalFileName },
|
|
161
|
+
});
|
|
162
|
+
});
|
|
104
163
|
_AllureReport_publish.set(this, async () => {
|
|
105
164
|
if (__classPrivateFieldGet(this, _AllureReport_published, "f")) {
|
|
106
165
|
return;
|
|
@@ -110,12 +169,13 @@ export class AllureReport {
|
|
|
110
169
|
}
|
|
111
170
|
let historyPoint = __classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f");
|
|
112
171
|
if (!historyPoint) {
|
|
113
|
-
|
|
114
|
-
const allTcs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
115
|
-
historyPoint = createHistory(this.reportUuid, this.reportName, allTcs, allTrs, this.reportUrl);
|
|
172
|
+
historyPoint = await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this);
|
|
116
173
|
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, historyPoint, "f");
|
|
117
174
|
}
|
|
118
175
|
await __classPrivateFieldGet(this, _AllureReport_writeTestResultRegistry, "f").call(this);
|
|
176
|
+
if (__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
|
|
177
|
+
await __classPrivateFieldGet(this, _AllureReport_writeQualityGateFiles, "f").call(this);
|
|
178
|
+
}
|
|
119
179
|
await __classPrivateFieldGet(this, _AllureReport_writeSummaryFiles, "f").call(this);
|
|
120
180
|
await __classPrivateFieldGet(this, _AllureReport_generateRootSummary, "f").call(this);
|
|
121
181
|
if (__classPrivateFieldGet(this, _AllureReport_realTime, "f") || !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
@@ -131,8 +191,9 @@ export class AllureReport {
|
|
|
131
191
|
const linksByPluginId = {};
|
|
132
192
|
const summariesSnapshot = __classPrivateFieldGet(this, _AllureReport_cloneSummariesByPluginId, "f").call(this);
|
|
133
193
|
const uploadProgressMessage = reportsToPublish.length === 1 ? `Publishing "${reportsToPublish[0].pluginId}" report` : "Publishing reports";
|
|
194
|
+
const rootRemoteReportFiles = __classPrivateFieldGet(this, _AllureReport_getRootRemoteReportFiles, "f").call(this);
|
|
134
195
|
const totalFilesToUpload = reportsToPublish.reduce((acc, report) => acc + Object.keys(report.files).length, 0) +
|
|
135
|
-
(
|
|
196
|
+
Object.keys(rootRemoteReportFiles).length;
|
|
136
197
|
let summariesMutated = false;
|
|
137
198
|
let reportCreated = false;
|
|
138
199
|
let publishErrorMessage = "Report upload has failed, the report won't be published";
|
|
@@ -167,11 +228,11 @@ export class AllureReport {
|
|
|
167
228
|
linksByPluginId[report.pluginId] = uploadResult.indexHref;
|
|
168
229
|
}
|
|
169
230
|
}
|
|
170
|
-
if (
|
|
231
|
+
if (Object.keys(rootRemoteReportFiles).length > 0) {
|
|
171
232
|
publishErrorMessage = "Test results registry upload has failed, the report won't be published";
|
|
172
233
|
await client.uploadReport({
|
|
173
234
|
reportUuid: this.reportUuid,
|
|
174
|
-
files:
|
|
235
|
+
files: rootRemoteReportFiles,
|
|
175
236
|
onProgress: incrementUploadProgress,
|
|
176
237
|
});
|
|
177
238
|
}
|
|
@@ -292,9 +353,15 @@ export class AllureReport {
|
|
|
292
353
|
return __classPrivateFieldGet(this, _AllureReport_qualityGate, "f").validate({
|
|
293
354
|
trs: trs.filter(Boolean),
|
|
294
355
|
state,
|
|
356
|
+
metrics: await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics(),
|
|
357
|
+
previousHistory: (await __classPrivateFieldGet(this, _AllureReport_store, "f").allHistoryDataPoints()).filter(({ uuid }) => uuid !== this.reportUuid),
|
|
295
358
|
environment: qualityGateEnvironment,
|
|
296
359
|
});
|
|
297
360
|
};
|
|
361
|
+
_AllureReport_getCwd.set(this, () => {
|
|
362
|
+
__classPrivateFieldSet(this, _AllureReport_cwd, __classPrivateFieldGet(this, _AllureReport_cwd, "f") ?? resolve(process.cwd()), "f");
|
|
363
|
+
return __classPrivateFieldGet(this, _AllureReport_cwd, "f");
|
|
364
|
+
});
|
|
298
365
|
this.start = async () => {
|
|
299
366
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").readHistory();
|
|
300
367
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "running") {
|
|
@@ -305,22 +372,17 @@ export class AllureReport {
|
|
|
305
372
|
}
|
|
306
373
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "running", "f");
|
|
307
374
|
__classPrivateFieldSet(this, _AllureReport_endGeneratePerfSpan, startPerfSpan(PERF_METRIC_NAMES.generateTotal), "f");
|
|
308
|
-
const cwd = resolve(process.cwd());
|
|
309
|
-
const cwdWithSep = cwd.endsWith(sep) ? cwd : `${cwd}${sep}`;
|
|
310
375
|
if (__classPrivateFieldGet(this, _AllureReport_globalAttachments, "f")?.length) {
|
|
376
|
+
const cwd = __classPrivateFieldGet(this, _AllureReport_getCwd, "f").call(this);
|
|
311
377
|
const matchedFiles = new Set();
|
|
312
378
|
for (const pattern of __classPrivateFieldGet(this, _AllureReport_globalAttachments, "f")) {
|
|
313
379
|
const files = await glob(pattern, { cwd, nodir: true, absolute: true });
|
|
314
|
-
files.forEach((filePath) => matchedFiles.add(filePath));
|
|
380
|
+
files.forEach((filePath) => matchedFiles.add(resolve(cwd, filePath)));
|
|
315
381
|
}
|
|
316
|
-
for (const
|
|
317
|
-
const absoluteFilePath = resolve(filePath);
|
|
318
|
-
const isInsideCwd = absoluteFilePath === cwd || absoluteFilePath.startsWith(cwdWithSep);
|
|
319
|
-
if (!isInsideCwd) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
382
|
+
for (const absoluteFilePath of matchedFiles) {
|
|
322
383
|
const originalFileName = basename(absoluteFilePath);
|
|
323
384
|
__classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher.sendGlobalAttachment(new PathResultFile(absoluteFilePath, originalFileName), originalFileName);
|
|
385
|
+
__classPrivateFieldGet(this, _AllureReport_recordArtifact, "f").call(this, absoluteFilePath, originalFileName);
|
|
324
386
|
}
|
|
325
387
|
}
|
|
326
388
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, true, async (plugin, context) => {
|
|
@@ -387,7 +449,7 @@ export class AllureReport {
|
|
|
387
449
|
const addJsonDumpEntry = async (entryName, value) => {
|
|
388
450
|
await addRequiredDumpEntry(Buffer.from(JSON.stringify(value)), entryName);
|
|
389
451
|
};
|
|
390
|
-
const dumpJsonEntries = ({ testResults, testCases, fixtures, attachments, environments, reportVariables, checkResults = {}, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexTestResultByResolutionIssue = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, resolutionIssues = {}, qualityGateResults = [], testResultIdsIngestOrder = [], }) => [
|
|
452
|
+
const dumpJsonEntries = ({ testResults, testCases, fixtures, attachments, environments, reportVariables, checkResults = {}, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexTestResultByResolutionIssue = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, resolutionIssues = {}, qualityGateResults = [], testResultIdsIngestOrder = [], metrics = [], }) => [
|
|
391
453
|
[AllureStoreDumpFiles.TestResults, testResults],
|
|
392
454
|
[AllureStoreDumpFiles.TestCases, testCases],
|
|
393
455
|
[AllureStoreDumpFiles.Fixtures, fixtures],
|
|
@@ -406,6 +468,7 @@ export class AllureReport {
|
|
|
406
468
|
[AllureStoreDumpFiles.IndexFixturesByTestResult, indexFixturesByTestResult],
|
|
407
469
|
[AllureStoreDumpFiles.QualityGateResults, qualityGateResults],
|
|
408
470
|
[AllureStoreDumpFiles.TestResultIngestOrder, testResultIdsIngestOrder],
|
|
471
|
+
[AllureStoreDumpFiles.Metrics, metrics],
|
|
409
472
|
];
|
|
410
473
|
let dumpError;
|
|
411
474
|
dumpArchive.pipe(dumpArchiveWriteStream);
|
|
@@ -473,10 +536,18 @@ export class AllureReport {
|
|
|
473
536
|
};
|
|
474
537
|
this.restoreState = async (dumps) => {
|
|
475
538
|
__classPrivateFieldGet(this, _AllureReport_store, "f").resetIngestOrder();
|
|
476
|
-
await __classPrivateFieldGet(this, _AllureReport_restoreStateDumps, "f").call(this, dumps);
|
|
539
|
+
await __classPrivateFieldGet(this, _AllureReport_restoreStateDumps, "f").call(this, dumps.map((path) => ({ artifactPath: path, path })));
|
|
477
540
|
};
|
|
541
|
+
_AllureReport_recordArtifact.set(this, (filePath, name = basename(filePath)) => {
|
|
542
|
+
const artifact = createReportArtifact(filePath, __classPrivateFieldGet(this, _AllureReport_getCwd, "f").call(this), name);
|
|
543
|
+
if (!__classPrivateFieldGet(this, _AllureReport_artifactFilesByPath, "f").has(artifact.path)) {
|
|
544
|
+
__classPrivateFieldGet(this, _AllureReport_artifactFilesByPath, "f").set(artifact.path, artifact);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
478
547
|
_AllureReport_restoreStateDumps.set(this, async (dumps) => measurePerf(PERF_METRIC_NAMES.restoreStateTotal, async () => {
|
|
479
|
-
|
|
548
|
+
let restoredCount = 0;
|
|
549
|
+
for (const { artifactPath, path: dump, recordArtifact = true } of deduplicateDumpInputs(dumps, __classPrivateFieldGet(this, _AllureReport_getCwd, "f").call(this))) {
|
|
550
|
+
const artifactFilePath = artifactPath ?? dump;
|
|
480
551
|
await measurePerf(PERF_METRIC_NAMES.restoreStateDump, async () => {
|
|
481
552
|
if (!existsSync(dump)) {
|
|
482
553
|
console.error(`Failed to restore state from "${dump}", continuing without it`);
|
|
@@ -505,14 +576,24 @@ export class AllureReport {
|
|
|
505
576
|
entryName.toLowerCase().endsWith(".zip"));
|
|
506
577
|
if (nestedDumpEntries.length > 0) {
|
|
507
578
|
const nestedDumpsTempDir = await mkdtemp(join(tmpdir(), `${basename(dump, ".zip")}-nested-`));
|
|
508
|
-
const
|
|
579
|
+
const nestedDumps = [];
|
|
509
580
|
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(nestedDumpsTempDir);
|
|
510
581
|
for (const [entryName] of nestedDumpEntries) {
|
|
511
|
-
const nestedDumpPath = join(nestedDumpsTempDir, `${
|
|
582
|
+
const nestedDumpPath = join(nestedDumpsTempDir, `${nestedDumps.length}-${basename(entryName)}`);
|
|
512
583
|
await writeFile(nestedDumpPath, await dumpArchive.entryData(entryName));
|
|
513
|
-
|
|
584
|
+
nestedDumps.push({
|
|
585
|
+
artifactPath: artifactFilePath,
|
|
586
|
+
path: nestedDumpPath,
|
|
587
|
+
recordArtifact: false,
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
const nestedRestoredCount = await __classPrivateFieldGet(this, _AllureReport_restoreStateDumps, "f").call(this, nestedDumps);
|
|
591
|
+
if (nestedRestoredCount > 0) {
|
|
592
|
+
restoredCount += 1;
|
|
593
|
+
if (recordArtifact) {
|
|
594
|
+
__classPrivateFieldGet(this, _AllureReport_recordArtifact, "f").call(this, artifactFilePath);
|
|
595
|
+
}
|
|
514
596
|
}
|
|
515
|
-
await __classPrivateFieldGet(this, _AllureReport_restoreStateDumps, "f").call(this, nestedDumpPaths);
|
|
516
597
|
return;
|
|
517
598
|
}
|
|
518
599
|
}
|
|
@@ -534,6 +615,7 @@ export class AllureReport {
|
|
|
534
615
|
const resolutionIssuesEntry = await optionalEntryData(AllureStoreDumpFiles.ResolutionIssues);
|
|
535
616
|
const qualityGateResultsEntry = await requiredEntryData(AllureStoreDumpFiles.QualityGateResults);
|
|
536
617
|
const testResultIngestOrderEntry = await optionalEntryData(AllureStoreDumpFiles.TestResultIngestOrder);
|
|
618
|
+
const metricsEntry = await optionalEntryData(AllureStoreDumpFiles.Metrics);
|
|
537
619
|
const attachmentsLinks = JSON.parse(attachmentsEntry.toString("utf8"));
|
|
538
620
|
const attachmentsEntries = dumpEntriesList.reduce((acc, [entryName, entry]) => {
|
|
539
621
|
switch (entryName) {
|
|
@@ -555,6 +637,7 @@ export class AllureReport {
|
|
|
555
637
|
case AllureStoreDumpFiles.IndexFixturesByTestResult:
|
|
556
638
|
case AllureStoreDumpFiles.QualityGateResults:
|
|
557
639
|
case AllureStoreDumpFiles.TestResultIngestOrder:
|
|
640
|
+
case AllureStoreDumpFiles.Metrics:
|
|
558
641
|
return acc;
|
|
559
642
|
default:
|
|
560
643
|
if (entry.isDirectory || !attachmentsLinks[entryName] || attachmentsLinks[entryName].missed) {
|
|
@@ -588,6 +671,7 @@ export class AllureReport {
|
|
|
588
671
|
testResultIdsIngestOrder: testResultIngestOrderEntry
|
|
589
672
|
? JSON.parse(testResultIngestOrderEntry.toString("utf8"))
|
|
590
673
|
: [],
|
|
674
|
+
metrics: metricsEntry ? JSON.parse(metricsEntry.toString("utf8")) : [],
|
|
591
675
|
};
|
|
592
676
|
const dumpTempDir = await mkdtemp(join(tmpdir(), basename(dump, ".zip")));
|
|
593
677
|
const resultsAttachments = {};
|
|
@@ -614,6 +698,10 @@ export class AllureReport {
|
|
|
614
698
|
});
|
|
615
699
|
await measurePerf(PERF_METRIC_NAMES.restoreStateStoreRestore, async () => __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments));
|
|
616
700
|
console.info(`Successfully restored state from "${dump}"`);
|
|
701
|
+
restoredCount += 1;
|
|
702
|
+
if (recordArtifact) {
|
|
703
|
+
__classPrivateFieldGet(this, _AllureReport_recordArtifact, "f").call(this, artifactFilePath);
|
|
704
|
+
}
|
|
617
705
|
}
|
|
618
706
|
catch (err) {
|
|
619
707
|
restoreError = err;
|
|
@@ -637,6 +725,7 @@ export class AllureReport {
|
|
|
637
725
|
}
|
|
638
726
|
});
|
|
639
727
|
}
|
|
728
|
+
return restoredCount;
|
|
640
729
|
}));
|
|
641
730
|
_AllureReport_getReportsToPublish.set(this, async () => {
|
|
642
731
|
const reports = [];
|
|
@@ -709,6 +798,25 @@ export class AllureReport {
|
|
|
709
798
|
const registry = createTestResultRegistry(testResults);
|
|
710
799
|
__classPrivateFieldSet(this, _AllureReport_testResultsRegistryPath, await __classPrivateFieldGet(this, _AllureReport_reportFiles, "f").addFile(TEST_RESULTS_REGISTRY_FILENAME, Buffer.from(JSON.stringify(registry))), "f");
|
|
711
800
|
});
|
|
801
|
+
_AllureReport_getRootRemoteReportFiles.set(this, () => ({
|
|
802
|
+
...(__classPrivateFieldGet(this, _AllureReport_testResultsRegistryPath, "f") ? { [TEST_RESULTS_REGISTRY_FILENAME]: __classPrivateFieldGet(this, _AllureReport_testResultsRegistryPath, "f") } : {}),
|
|
803
|
+
}));
|
|
804
|
+
_AllureReport_writeQualityGateFiles.set(this, async () => {
|
|
805
|
+
const qualityGateResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").qualityGateResults();
|
|
806
|
+
await __classPrivateFieldGet(this, _AllureReport_reportFiles, "f").addFile(QUALITY_GATE_RESULTS_FILENAME, Buffer.from(JSON.stringify(qualityGateResults)));
|
|
807
|
+
});
|
|
808
|
+
_AllureReport_finishArtifactsManifest.set(this, async () => {
|
|
809
|
+
if (__classPrivateFieldGet(this, _AllureReport_artifactFilesByPath, "f").size === 0) {
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
const manifest = [...__classPrivateFieldGet(this, _AllureReport_artifactFilesByPath, "f").values()];
|
|
813
|
+
try {
|
|
814
|
+
await writeFile(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), ARTIFACTS_MANIFEST_FILENAME), JSON.stringify(manifest));
|
|
815
|
+
}
|
|
816
|
+
catch (err) {
|
|
817
|
+
console.error("Failed to write Allure artifacts manifest", err);
|
|
818
|
+
}
|
|
819
|
+
});
|
|
712
820
|
_AllureReport_generateRootSummary.set(this, async () => {
|
|
713
821
|
const summaries = [...__classPrivateFieldGet(this, _AllureReport_summariesByPluginId, "f").values()].map(clonePluginSummary);
|
|
714
822
|
if (summaries.length > 1) {
|
|
@@ -724,9 +832,6 @@ export class AllureReport {
|
|
|
724
832
|
throw new Error(INIT_REQUIRED_ERROR_MESSAGE);
|
|
725
833
|
}
|
|
726
834
|
try {
|
|
727
|
-
const testResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
728
|
-
const testCases = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
729
|
-
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, createHistory(this.reportUuid, this.reportName, testCases, testResults, this.reportUrl), "f");
|
|
730
835
|
__classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").close();
|
|
731
836
|
try {
|
|
732
837
|
await __classPrivateFieldGet(this, _AllureReport_realtimeUpdateScheduler, "f").close();
|
|
@@ -739,6 +844,7 @@ export class AllureReport {
|
|
|
739
844
|
await this.dumpState();
|
|
740
845
|
return;
|
|
741
846
|
}
|
|
847
|
+
await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
|
|
742
848
|
await measurePerf(PERF_METRIC_NAMES.generatePluginsDone, async () => {
|
|
743
849
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
744
850
|
await measurePerf(`${PERF_METRIC_PREFIXES.generatePluginDone}${context.id}`, async () => {
|
|
@@ -747,6 +853,8 @@ export class AllureReport {
|
|
|
747
853
|
});
|
|
748
854
|
});
|
|
749
855
|
__classPrivateFieldGet(this, _AllureReport_finishGeneratePerfSpan, "f").call(this);
|
|
856
|
+
await __classPrivateFieldGet(this, _AllureReport_ingestSelfPerfMetrics, "f").call(this);
|
|
857
|
+
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this), "f");
|
|
750
858
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
751
859
|
const summary = await plugin?.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
752
860
|
if (!summary) {
|
|
@@ -777,11 +885,19 @@ export class AllureReport {
|
|
|
777
885
|
}
|
|
778
886
|
const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
|
|
779
887
|
const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
|
|
780
|
-
|
|
888
|
+
const shouldFlattenOutput = outputDirectoryEntries.length === 1;
|
|
889
|
+
if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
|
|
890
|
+
const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
|
|
891
|
+
if (shouldFlattenOutput) {
|
|
892
|
+
historyUrl.pathname = `${historyUrl.pathname}index.html`;
|
|
893
|
+
}
|
|
894
|
+
__classPrivateFieldSet(this, _AllureReport_historyDataPoint, setHistoryDataPointUrl(__classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"), historyUrl.toString()), "f");
|
|
895
|
+
}
|
|
896
|
+
if (shouldFlattenOutput) {
|
|
781
897
|
const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"), outputDirectoryEntries[0].file);
|
|
782
898
|
const reportContent = await readdir(reportPath);
|
|
783
899
|
for (const entry of reportContent) {
|
|
784
|
-
if (entry
|
|
900
|
+
if (ROOT_INTEGRATION_FILENAMES.has(entry)) {
|
|
785
901
|
continue;
|
|
786
902
|
}
|
|
787
903
|
const currentFilePath = join(reportPath, entry);
|
|
@@ -790,6 +906,7 @@ export class AllureReport {
|
|
|
790
906
|
}
|
|
791
907
|
await rm(reportPath, { recursive: true });
|
|
792
908
|
}
|
|
909
|
+
await __classPrivateFieldGet(this, _AllureReport_finishArtifactsManifest, "f").call(this);
|
|
793
910
|
for (const dir of __classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f")) {
|
|
794
911
|
try {
|
|
795
912
|
await rm(dir, { recursive: true });
|
|
@@ -818,11 +935,6 @@ export class AllureReport {
|
|
|
818
935
|
console.info(`- ${href}`);
|
|
819
936
|
});
|
|
820
937
|
}
|
|
821
|
-
if (!__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
const qualityGateResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").qualityGateResultsByEnv();
|
|
825
|
-
await writeFile(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), "quality-gate.json"), JSON.stringify(qualityGateResults));
|
|
826
938
|
}
|
|
827
939
|
finally {
|
|
828
940
|
await __classPrivateFieldGet(this, _AllureReport_finishPerfMetrics, "f").call(this);
|
|
@@ -835,7 +947,7 @@ export class AllureReport {
|
|
|
835
947
|
_AllureReport_finishPerfMetrics.set(this, async () => {
|
|
836
948
|
__classPrivateFieldGet(this, _AllureReport_finishGeneratePerfSpan, "f").call(this);
|
|
837
949
|
try {
|
|
838
|
-
await writePerfMetrics(__classPrivateFieldGet(this, _AllureReport_output, "f"));
|
|
950
|
+
await writePerfMetrics(__classPrivateFieldGet(this, _AllureReport_output, "f"), perfMetricsFileName(this.reportUuid));
|
|
839
951
|
}
|
|
840
952
|
catch (err) {
|
|
841
953
|
console.error("Failed to write Allure performance metrics", err);
|
|
@@ -893,12 +1005,13 @@ export class AllureReport {
|
|
|
893
1005
|
}
|
|
894
1006
|
}
|
|
895
1007
|
});
|
|
896
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], resolutions, reportFiles, realTime, historyPath, historyLimit, appendHistory, defaultLabels = {}, variables = {}, environment, allowedEnvironments, environments, output, hideLabels, qualityGate, dump, categories, allureService, globalAttachments, } = opts;
|
|
1008
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], resolutions, reportFiles, realTime, historyPath, historyBaseUrl, historyLimit, appendHistory, defaultLabels = {}, variables = {}, environment, allowedEnvironments, environments, output, hideLabels, qualityGate, performance, dump, categories, allureService, globalAttachments, cwd, } = opts;
|
|
897
1009
|
const allureServiceAccessToken = allureService?.accessToken;
|
|
898
1010
|
if (allureServiceAccessToken) {
|
|
899
1011
|
const allureServiceClientConfig = {
|
|
900
1012
|
...allureService,
|
|
901
1013
|
accessToken: allureServiceAccessToken,
|
|
1014
|
+
uploadConcurrency: parseIntegerConfigValue(allureService.uploadConcurrency, 1) ?? DEFAULT_UPLOAD_CONCURRENCY,
|
|
902
1015
|
};
|
|
903
1016
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceAccessToken.startsWith("ato1.")
|
|
904
1017
|
? new AllureTestOpsClient(allureServiceClientConfig)
|
|
@@ -907,6 +1020,7 @@ export class AllureReport {
|
|
|
907
1020
|
: undefined, "f");
|
|
908
1021
|
}
|
|
909
1022
|
this.reportUuid = randomUUID();
|
|
1023
|
+
__classPrivateFieldSet(this, _AllureReport_cwd, cwd ? resolve(cwd) : undefined, "f");
|
|
910
1024
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
911
1025
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
912
1026
|
this.reportName = [name, reportTitleSuffix].filter(Boolean).join(" – ");
|
|
@@ -923,6 +1037,7 @@ export class AllureReport {
|
|
|
923
1037
|
__classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
|
|
924
1038
|
}
|
|
925
1039
|
__classPrivateFieldSet(this, _AllureReport_categories, normalizeCategoriesConfig(categories), "f");
|
|
1040
|
+
__classPrivateFieldSet(this, _AllureReport_historyBaseUrl, !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && historyPath && historyBaseUrl ? normalizeHistoryBaseUrl(historyBaseUrl) : undefined, "f");
|
|
926
1041
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
927
1042
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
928
1043
|
limit: historyLimit,
|
|
@@ -946,6 +1061,7 @@ export class AllureReport {
|
|
|
946
1061
|
defaultLabels,
|
|
947
1062
|
environment,
|
|
948
1063
|
allowedEnvironments,
|
|
1064
|
+
performance,
|
|
949
1065
|
}), "f");
|
|
950
1066
|
__classPrivateFieldSet(this, _AllureReport_readers, [...readers], "f");
|
|
951
1067
|
__classPrivateFieldSet(this, _AllureReport_plugins, [...plugins], "f");
|
|
@@ -965,6 +1081,6 @@ export class AllureReport {
|
|
|
965
1081
|
return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
|
|
966
1082
|
}
|
|
967
1083
|
}
|
|
968
|
-
_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_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_published = new WeakMap(), _AllureReport_endGeneratePerfSpan = new WeakMap(), _AllureReport_publish = new WeakMap(), _AllureReport_runRealtimeUpdate = 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_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) {
|
|
1084
|
+
_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) {
|
|
969
1085
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
|
970
1086
|
};
|
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.js
CHANGED
|
@@ -53,6 +53,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
53
53
|
expectedResultHtml: raw.expectedResultHtml,
|
|
54
54
|
flaky: raw.flaky ?? false,
|
|
55
55
|
muted: raw.muted ?? false,
|
|
56
|
+
known: raw.known ?? false,
|
|
56
57
|
isRetry: false,
|
|
57
58
|
labels,
|
|
58
59
|
steps: convertSteps(stateData, raw.steps).convertedSteps,
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AllureCheckResult, type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type GlobalAttachmentLink, type HistoryDataPoint, type HistoryTestResult, type ResolutionIssue, type ResolutionsConfig, 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 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>;
|
|
@@ -21,6 +21,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
21
21
|
allowedEnvironments?: string[];
|
|
22
22
|
environmentsConfig?: EnvironmentsConfig;
|
|
23
23
|
reportVariables?: ReportVariables;
|
|
24
|
+
performance?: PerformanceConfig;
|
|
24
25
|
});
|
|
25
26
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
26
27
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
@@ -35,6 +36,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
35
36
|
allGlobalAttachments(): Promise<GlobalAttachmentLink[]>;
|
|
36
37
|
allGlobalAttachmentsByEnv(): Promise<Record<string, GlobalAttachmentLink[]>>;
|
|
37
38
|
visitCheckResult(result: AllureCheckResult): Promise<void>;
|
|
39
|
+
visitMetrics(metrics: AllurePerformanceResult[], context?: ReaderContext): Promise<void>;
|
|
38
40
|
visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
|
|
39
41
|
visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
|
|
40
42
|
visitAttachmentFile(resultFile: ResultFile): Promise<void>;
|
|
@@ -57,6 +59,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
57
59
|
allResolutionIssues(): Promise<ResolutionIssue[]>;
|
|
58
60
|
resolutionIssueByTestResultId(trId: string): Promise<ResolutionIssue | undefined>;
|
|
59
61
|
testResultsByResolutionIssueId(resolutionIssueId: string): Promise<TestResult[]>;
|
|
62
|
+
allMetrics(): Promise<MetricSample[]>;
|
|
60
63
|
allNewTestResults(filter?: TestResultFilter, history?: HistoryDataPoint[]): Promise<TestResult[]>;
|
|
61
64
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
62
65
|
testResultById(trId: string): Promise<TestResult | undefined>;
|