@allurereport/core 3.19.1 → 3.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/history.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { type AllureHistory, type HistoryDataPoint, type MetricSample, type TestCase, type TestResult } from "@allurereport/core-api";
2
2
  export declare const normalizeHistoryBaseUrl: (historyBaseUrl: string) => string;
3
- export declare const setHistoryDataPointUrl: (point: HistoryDataPoint, url: string) => HistoryDataPoint;
4
3
  export declare const createHistory: (reportUuid: string, reportName: string | undefined, testCases: TestCase[], testResults: TestResult[], remoteUrl?: string, metrics?: MetricSample[]) => HistoryDataPoint;
5
4
  export declare class AllureLocalHistory implements AllureHistory {
6
5
  #private;
package/dist/history.js CHANGED
@@ -70,11 +70,6 @@ export const normalizeHistoryBaseUrl = (historyBaseUrl) => {
70
70
  url.pathname = `${url.pathname.replace(/\/+$/u, "")}/`;
71
71
  return url.toString();
72
72
  };
73
- export const setHistoryDataPointUrl = (point, url) => ({
74
- ...point,
75
- url,
76
- testResults: Object.fromEntries(Object.entries(point.testResults).map(([historyId, item]) => [historyId, { ...item, url }])),
77
- });
78
73
  export const createHistory = (reportUuid, reportName = "Allure Report", testCases, testResults, remoteUrl = "", metrics = []) => {
79
74
  const knownTestCaseIds = testCases.map((tc) => tc.id);
80
75
  return {
package/dist/report.d.ts CHANGED
@@ -8,12 +8,13 @@ export declare class AllureReport {
8
8
  #private;
9
9
  readonly reportUuid: string;
10
10
  readonly reportName: string;
11
- reportUrl?: string;
12
11
  constructor(opts: FullConfig);
13
12
  get hasQualityGate(): boolean;
14
13
  get store(): DefaultAllureStore;
15
14
  get realtimeSubscriber(): RealtimeSubscriber;
16
15
  get realtimeDispatcher(): RealtimeEventsDispatcher;
16
+ get reportUrl(): string | undefined;
17
+ set reportUrl(url: string | undefined);
17
18
  readDirectory: (resultsDir: string) => Promise<void>;
18
19
  readFile: (resultsFile: string) => Promise<void>;
19
20
  readResult: (data: ResultFile) => Promise<void>;
package/dist/report.js CHANGED
@@ -9,12 +9,12 @@ 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_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;
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_resolvedReportUrl, _AllureReport_reportUrl, _AllureReport_resolveReportUrl, _AllureReport_createHistoryDataPoint, _AllureReport_ingestSelfPerfMetrics, _AllureReport_prepareReportFiles, _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
- import { lstat, mkdtemp, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
17
+ import { lstat, mkdtemp, readdir, rename, rm, writeFile } from "node:fs/promises";
18
18
  import { tmpdir } from "node:os";
19
19
  import { basename, dirname, join, resolve } from "node:path";
20
20
  import { promisify } from "node:util";
@@ -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, normalizeHistoryBaseUrl, setHistoryDataPointUrl } from "./history.js";
33
+ import { AllureLocalHistory, createHistory, normalizeHistoryBaseUrl } 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";
@@ -81,9 +81,7 @@ const getExecutorReportUrl = (executor) => {
81
81
  return undefined;
82
82
  }
83
83
  try {
84
- const navUrl = new URL(reportUrl);
85
- navUrl.pathname = navUrl.pathname.endsWith("/") ? navUrl.pathname : `${navUrl.pathname}/`;
86
- return navUrl.toString();
84
+ return new URL(reportUrl).toString();
87
85
  }
88
86
  catch {
89
87
  return undefined;
@@ -134,22 +132,27 @@ export class AllureReport {
134
132
  _AllureReport_artifactFilesByPath.set(this, new Map());
135
133
  _AllureReport_published.set(this, false);
136
134
  _AllureReport_endGeneratePerfSpan.set(this, void 0);
137
- _AllureReport_resolveHistoryReportUrl.set(this, async () => {
138
- if (this.reportUrl) {
139
- return this.reportUrl;
135
+ _AllureReport_resolvedReportUrl.set(this, void 0);
136
+ _AllureReport_reportUrl.set(this, void 0);
137
+ _AllureReport_resolveReportUrl.set(this, async () => {
138
+ if (__classPrivateFieldGet(this, _AllureReport_reportUrl, "f"))
139
+ return;
140
+ if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
141
+ const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
142
+ historyUrl.pathname = `${historyUrl.pathname}index.html`;
143
+ __classPrivateFieldSet(this, _AllureReport_resolvedReportUrl, historyUrl.toString(), "f");
144
+ return;
140
145
  }
141
146
  const executorReportUrl = getExecutorReportUrl(await __classPrivateFieldGet(this, _AllureReport_store, "f").metadataByKey("allure2_executor"));
142
- if (executorReportUrl) {
143
- this.reportUrl = executorReportUrl;
144
- return executorReportUrl;
145
- }
146
- return "";
147
+ if (!executorReportUrl)
148
+ return;
149
+ __classPrivateFieldSet(this, _AllureReport_resolvedReportUrl, executorReportUrl, "f");
147
150
  });
148
- _AllureReport_createHistoryDataPoint.set(this, async () => {
151
+ _AllureReport_createHistoryDataPoint.set(this, async (flattenReport) => {
149
152
  const allTrs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
150
153
  const allTcs = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
151
- const historyReportUrl = await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
152
- return createHistory(this.reportUuid, this.reportName, allTcs, allTrs, historyReportUrl, await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics());
154
+ const historyUrl = __classPrivateFieldGet(this, _AllureReport_reportUrl, "f") ?? (!flattenReport && __classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f") ? __classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f") : __classPrivateFieldGet(this, _AllureReport_resolvedReportUrl, "f"));
155
+ return createHistory(this.reportUuid, this.reportName, allTcs, allTrs, historyUrl ?? "", await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics());
153
156
  });
154
157
  _AllureReport_ingestSelfPerfMetrics.set(this, async () => {
155
158
  if (!isPerfMetricsEnabled()) {
@@ -165,6 +168,14 @@ export class AllureReport {
165
168
  metadata: { originalFileName },
166
169
  });
167
170
  });
171
+ _AllureReport_prepareReportFiles.set(this, async () => {
172
+ await __classPrivateFieldGet(this, _AllureReport_writeTestResultRegistry, "f").call(this);
173
+ if (__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
174
+ await __classPrivateFieldGet(this, _AllureReport_writeQualityGateFiles, "f").call(this);
175
+ }
176
+ await __classPrivateFieldGet(this, _AllureReport_writeSummaryFiles, "f").call(this);
177
+ await __classPrivateFieldGet(this, _AllureReport_generateRootSummary, "f").call(this);
178
+ });
168
179
  _AllureReport_publish.set(this, async () => {
169
180
  if (__classPrivateFieldGet(this, _AllureReport_published, "f")) {
170
181
  return;
@@ -172,17 +183,6 @@ export class AllureReport {
172
183
  if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "done") {
173
184
  throw new Error("report is not completed. Call the done() method first.");
174
185
  }
175
- let historyPoint = __classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f");
176
- if (!historyPoint) {
177
- historyPoint = await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this);
178
- __classPrivateFieldSet(this, _AllureReport_historyDataPoint, historyPoint, "f");
179
- }
180
- await __classPrivateFieldGet(this, _AllureReport_writeTestResultRegistry, "f").call(this);
181
- if (__classPrivateFieldGet(this, _AllureReport_qualityGate, "f")) {
182
- await __classPrivateFieldGet(this, _AllureReport_writeQualityGateFiles, "f").call(this);
183
- }
184
- await __classPrivateFieldGet(this, _AllureReport_writeSummaryFiles, "f").call(this);
185
- await __classPrivateFieldGet(this, _AllureReport_generateRootSummary, "f").call(this);
186
186
  if (__classPrivateFieldGet(this, _AllureReport_realTime, "f") || !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
187
187
  __classPrivateFieldSet(this, _AllureReport_published, true, "f");
188
188
  return;
@@ -271,7 +271,7 @@ export class AllureReport {
271
271
  publishErrorMessage = "Report completion has failed, the report won't be published";
272
272
  await client.completeReport({
273
273
  reportUuid: this.reportUuid,
274
- historyPoint,
274
+ historyPoint: __classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"),
275
275
  });
276
276
  Object.values(linksByPluginId)
277
277
  .filter(Boolean)
@@ -319,8 +319,7 @@ export class AllureReport {
319
319
  });
320
320
  await Promise.all(entries.map((dirent) => limit(async () => {
321
321
  try {
322
- const path = await measurePerfAggregate(PERF_METRIC_NAMES.generateReadResultsRealpath, () => realpath(join(resultsDirPath, dirent.name)));
323
- await this.readResult(new PathResultFile(path, dirent.name));
322
+ await this.readResult(new PathResultFile(join(resultsDirPath, dirent.name), dirent.name));
324
323
  }
325
324
  catch (e) {
326
325
  console.error(`can't read result file ${dirent.name}`, e);
@@ -866,7 +865,7 @@ export class AllureReport {
866
865
  await this.dumpState();
867
866
  return;
868
867
  }
869
- await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
868
+ await __classPrivateFieldGet(this, _AllureReport_resolveReportUrl, "f").call(this);
870
869
  await measurePerf(PERF_METRIC_NAMES.generatePluginsDone, async () => {
871
870
  await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
872
871
  await measurePerf(`${PERF_METRIC_PREFIXES.generatePluginDone}${context.id}`, async () => {
@@ -876,7 +875,6 @@ export class AllureReport {
876
875
  });
877
876
  __classPrivateFieldGet(this, _AllureReport_finishGeneratePerfSpan, "f").call(this);
878
877
  await __classPrivateFieldGet(this, _AllureReport_ingestSelfPerfMetrics, "f").call(this);
879
- __classPrivateFieldSet(this, _AllureReport_historyDataPoint, await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this), "f");
880
878
  await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
881
879
  const summary = await plugin?.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
882
880
  if (!summary) {
@@ -893,28 +891,23 @@ export class AllureReport {
893
891
  __classPrivateFieldSet(this, _AllureReport_summariesByPluginId, new Map(summaries
894
892
  .filter((summary) => !!summary.pluginId)
895
893
  .map((summary) => [summary.pluginId, summary])), "f");
896
- await __classPrivateFieldGet(this, _AllureReport_publish, "f").call(this);
894
+ await __classPrivateFieldGet(this, _AllureReport_prepareReportFiles, "f").call(this);
897
895
  let outputDirFiles = [];
898
896
  try {
899
897
  outputDirFiles = await readdir(__classPrivateFieldGet(this, _AllureReport_output, "f"));
900
898
  }
901
899
  catch { }
900
+ const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
901
+ const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
902
+ const shouldFlattenOutput = outputDirectoryEntries.length === 1;
903
+ __classPrivateFieldSet(this, _AllureReport_historyDataPoint, await __classPrivateFieldGet(this, _AllureReport_createHistoryDataPoint, "f").call(this, shouldFlattenOutput), "f");
904
+ await __classPrivateFieldGet(this, _AllureReport_publish, "f").call(this);
902
905
  if (__classPrivateFieldGet(this, _AllureReport_knownIssuesPath, "f")) {
903
906
  await writeKnownIssues(__classPrivateFieldGet(this, _AllureReport_store, "f"), __classPrivateFieldGet(this, _AllureReport_knownIssuesPath, "f"));
904
907
  }
905
908
  if (outputDirFiles.length === 0) {
906
909
  return;
907
910
  }
908
- const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
909
- const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
910
- const shouldFlattenOutput = outputDirectoryEntries.length === 1;
911
- if (__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f")) {
912
- const historyUrl = new URL(__classPrivateFieldGet(this, _AllureReport_historyBaseUrl, "f"));
913
- if (shouldFlattenOutput) {
914
- historyUrl.pathname = `${historyUrl.pathname}index.html`;
915
- }
916
- __classPrivateFieldSet(this, _AllureReport_historyDataPoint, setHistoryDataPointUrl(__classPrivateFieldGet(this, _AllureReport_historyDataPoint, "f"), historyUrl.toString()), "f");
917
- }
918
911
  if (shouldFlattenOutput) {
919
912
  const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"), outputDirectoryEntries[0].file);
920
913
  const reportContent = await readdir(reportPath);
@@ -1030,7 +1023,9 @@ export class AllureReport {
1030
1023
  };
1031
1024
  try {
1032
1025
  await consumer.call(this, plugin, pluginContext);
1033
- this.reportUrl = pluginContext.reportUrl ?? this.reportUrl;
1026
+ if (pluginContext.reportUrl !== null && pluginContext.reportUrl !== this.reportUrl) {
1027
+ this.reportUrl = pluginContext.reportUrl;
1028
+ }
1034
1029
  if (initState) {
1035
1030
  __classPrivateFieldGet(this, _AllureReport_state, "f")[id] = pluginState;
1036
1031
  }
@@ -1120,7 +1115,13 @@ export class AllureReport {
1120
1115
  get realtimeDispatcher() {
1121
1116
  return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
1122
1117
  }
1118
+ get reportUrl() {
1119
+ return __classPrivateFieldGet(this, _AllureReport_reportUrl, "f") ?? __classPrivateFieldGet(this, _AllureReport_resolvedReportUrl, "f");
1120
+ }
1121
+ set reportUrl(url) {
1122
+ __classPrivateFieldSet(this, _AllureReport_reportUrl, url, "f");
1123
+ }
1123
1124
  }
1124
- _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) {
1125
+ _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_resolvedReportUrl = new WeakMap(), _AllureReport_reportUrl = new WeakMap(), _AllureReport_resolveReportUrl = new WeakMap(), _AllureReport_createHistoryDataPoint = new WeakMap(), _AllureReport_ingestSelfPerfMetrics = new WeakMap(), _AllureReport_prepareReportFiles = 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) {
1125
1126
  return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
1126
1127
  };
@@ -1,4 +1,4 @@
1
- import type { ResolutionRule, ResolutionsConfig, TestResult } from "@allurereport/core-api";
1
+ import type { IssueResolutionRule, ResolutionIssue, ResolutionRule, ResolutionsConfig, TestResult } from "@allurereport/core-api";
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;
@@ -12,5 +12,6 @@ export declare const KNOWN_FROM_RESULT_RESOLUTION: {
12
12
  };
13
13
  export declare const getResolutionByRules: (testResult: TestResult, config?: ResolutionsConfig) => ResolutionRule | undefined;
14
14
  export declare const isIgnoredFailure: (testResult: TestResult) => boolean;
15
+ export declare const createResolutionIssue: (rule: IssueResolutionRule, config?: ResolutionsConfig) => ResolutionIssue;
15
16
  export declare const resolveExactIssuesFilePath: (pathOrDir: string | undefined, label: string) => Promise<string | undefined>;
16
17
  export declare const writeKnownIssues: (store: AllureStore, knownIssuesPath?: string) => Promise<void>;
@@ -52,7 +52,7 @@ const validateIssueUrl = (rule, template, errors) => {
52
52
  }
53
53
  let url;
54
54
  try {
55
- url = new URL(template.urlTemplate.replace("%s", encodeURIComponent(rule.issue.id)));
55
+ url = new URL(template.urlTemplate.replace("%s", () => encodeURIComponent(rule.issue.id)));
56
56
  }
57
57
  catch {
58
58
  errors.push(`resolutions.links.${rule.issue.type}.urlTemplate must resolve to an absolute URL`);
@@ -155,6 +155,21 @@ export const getResolutionByRules = (testResult, config) => {
155
155
  return undefined;
156
156
  };
157
157
  export const isIgnoredFailure = (testResult) => testResult.resolution === "muted" || testResult.resolution === "accepted";
158
+ export const createResolutionIssue = (rule, config) => {
159
+ const template = config?.links?.[rule.issue.type];
160
+ const issue = { ...rule.issue, comment: rule.comment };
161
+ if (!template) {
162
+ return issue;
163
+ }
164
+ return {
165
+ ...issue,
166
+ link: {
167
+ name: template.nameTemplate?.replace("%s", () => rule.issue.id) ?? rule.issue.id,
168
+ url: template.urlTemplate.replace("%s", () => encodeURIComponent(rule.issue.id)),
169
+ type: rule.issue.type,
170
+ },
171
+ };
172
+ };
158
173
  export const resolveExactIssuesFilePath = async (pathOrDir, label) => {
159
174
  if (!pathOrDir)
160
175
  return undefined;
@@ -48,15 +48,18 @@ export class RetrySubstore {
48
48
  });
49
49
  }
50
50
  retriesByTr(testResult) {
51
- if (!testResult.retryHash || testResult.isRetry) {
51
+ if (!testResult.retryHash) {
52
52
  return NO_RETRIES;
53
53
  }
54
54
  const attempts = __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").get(testResult.retryHash) ?? [];
55
+ if (attempts.length <= 1) {
56
+ return NO_RETRIES;
57
+ }
55
58
  const index = attempts.findIndex((attempt) => attempt.id === testResult.id);
56
- if (index !== 0) {
59
+ if (index === -1) {
57
60
  return NO_RETRIES;
58
61
  }
59
- return attempts.slice(1);
62
+ return attempts.filter((attempt) => attempt.id !== testResult.id);
60
63
  }
61
64
  reset() {
62
65
  __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").clear();
@@ -82,6 +82,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
82
82
  attachmentsByTrId: Map<string, AttachmentLink[]>;
83
83
  fixturesByTrId: Map<string, TestFixtureResult[]>;
84
84
  historyByTrId: Map<string, HistoryTestResult[] | undefined>;
85
+ resolutionIssuesByTrId: Map<string, ResolutionIssue | undefined>;
85
86
  retriesByTrId: Map<string, TestResult[]>;
86
87
  }>;
87
88
  failedTestResults(): Promise<TestResult[]>;
@@ -13,7 +13,7 @@ var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllu
13
13
  import { extname } from "node:path";
14
14
  import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, calculateEnvironmentHash, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, compareBy, createDictionary, fallbackTestCaseIdLabelName, getWorstStatus, createHistoryTestResultLookup, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
15
15
  import { md5, } from "@allurereport/plugin-api";
16
- import { getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
16
+ import { createResolutionIssue, getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
17
17
  import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
18
18
  import { createFlakyDetector } from "../utils/flaky.js";
19
19
  import { getStatusTransition } from "../utils/new.js";
@@ -689,11 +689,14 @@ export class DefaultAllureStore {
689
689
  const attachmentsByTrId = new Map();
690
690
  const fixturesByTrId = new Map();
691
691
  const historyByTrId = new Map();
692
+ const resolutionIssuesByTrId = new Map();
692
693
  const retriesByTrId = new Map();
693
694
  for (const trId of trIds) {
694
695
  const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
696
+ const resolutionIssueId = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").get(trId);
695
697
  attachmentsByTrId.set(trId, this.indexAttachmentByTestResult.get(trId) ?? []);
696
698
  fixturesByTrId.set(trId, this.indexFixturesByTestResult.get(trId) ?? []);
699
+ resolutionIssuesByTrId.set(trId, resolutionIssueId ? __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").get(resolutionIssueId) : undefined);
697
700
  retriesByTrId.set(trId, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr));
698
701
  historyByTrId.set(trId, tr ? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyByTr).call(this, tr) : undefined);
699
702
  }
@@ -701,6 +704,7 @@ export class DefaultAllureStore {
701
704
  attachmentsByTrId,
702
705
  fixturesByTrId,
703
706
  historyByTrId,
707
+ resolutionIssuesByTrId,
704
708
  retriesByTrId,
705
709
  };
706
710
  }
@@ -1195,7 +1199,7 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments
1195
1199
  testResult.resolution = rule.resolution;
1196
1200
  testResult.resolutionComment = rule.comment;
1197
1201
  if (rule.resolution === "issue") {
1198
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, { ...rule.issue, comment: rule.comment }, testResult.id);
1202
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, createResolutionIssue(rule, __classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f")), testResult.id);
1199
1203
  }
1200
1204
  }, _DefaultAllureStore_associateResolutionIssue = function _DefaultAllureStore_associateResolutionIssue(resolutionIssue, testResultId) {
1201
1205
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResultId);
@@ -19,7 +19,6 @@ export declare const PERF_METRIC_NAMES: {
19
19
  readonly generateReadResultsXcresultCheck: "generate.readResults.xcresultCheck";
20
20
  readonly generateReadResultsReaddir: "generate.readResults.readdir";
21
21
  readonly generateReadResultsFiles: "generate.readResults.files";
22
- readonly generateReadResultsRealpath: "generate.readResults.realpath";
23
22
  readonly generateReadResultsReaderRead: "generate.readResults.reader.read";
24
23
  readonly generatePluginsDone: "generate.plugins.done";
25
24
  readonly storeVisitTestResultConvert: "store.visitTestResult.convert";
@@ -24,7 +24,6 @@ export const PERF_METRIC_NAMES = {
24
24
  generateReadResultsXcresultCheck: "generate.readResults.xcresultCheck",
25
25
  generateReadResultsReaddir: "generate.readResults.readdir",
26
26
  generateReadResultsFiles: "generate.readResults.files",
27
- generateReadResultsRealpath: "generate.readResults.realpath",
28
27
  generateReadResultsReaderRead: "generate.readResults.reader.read",
29
28
  generatePluginsDone: "generate.plugins.done",
30
29
  storeVisitTestResultConvert: "store.visitTestResult.convert",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.19.1",
3
+ "version": "3.20.1",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,32 +25,32 @@
25
25
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
26
26
  },
27
27
  "dependencies": {
28
- "@allurereport/ci": "3.19.1",
29
- "@allurereport/cli-commons": "3.19.1",
30
- "@allurereport/core-api": "3.19.1",
31
- "@allurereport/plugin-agent": "3.19.1",
32
- "@allurereport/plugin-allure2": "3.19.1",
33
- "@allurereport/plugin-api": "3.19.1",
34
- "@allurereport/plugin-awesome": "3.19.1",
35
- "@allurereport/plugin-classic": "3.19.1",
36
- "@allurereport/plugin-csv": "3.19.1",
37
- "@allurereport/plugin-dashboard": "3.19.1",
38
- "@allurereport/plugin-jira": "3.19.1",
39
- "@allurereport/plugin-log": "3.19.1",
40
- "@allurereport/plugin-progress": "3.19.1",
41
- "@allurereport/plugin-slack": "3.19.1",
42
- "@allurereport/plugin-testops": "3.19.1",
43
- "@allurereport/plugin-testplan": "3.19.1",
44
- "@allurereport/reader": "3.19.1",
45
- "@allurereport/reader-api": "3.19.1",
46
- "@allurereport/service": "3.19.1",
47
- "@allurereport/summary": "3.19.1",
28
+ "@allurereport/ci": "3.20.1",
29
+ "@allurereport/cli-commons": "3.20.1",
30
+ "@allurereport/core-api": "3.20.1",
31
+ "@allurereport/plugin-agent": "3.20.1",
32
+ "@allurereport/plugin-allure2": "3.20.1",
33
+ "@allurereport/plugin-api": "3.20.1",
34
+ "@allurereport/plugin-awesome": "3.20.1",
35
+ "@allurereport/plugin-classic": "3.20.1",
36
+ "@allurereport/plugin-csv": "3.20.1",
37
+ "@allurereport/plugin-dashboard": "3.20.1",
38
+ "@allurereport/plugin-jira": "3.20.1",
39
+ "@allurereport/plugin-log": "3.20.1",
40
+ "@allurereport/plugin-progress": "3.20.1",
41
+ "@allurereport/plugin-slack": "3.20.1",
42
+ "@allurereport/plugin-testops": "3.20.1",
43
+ "@allurereport/plugin-testplan": "3.20.1",
44
+ "@allurereport/reader": "3.20.1",
45
+ "@allurereport/reader-api": "3.20.1",
46
+ "@allurereport/service": "3.20.1",
47
+ "@allurereport/summary": "3.20.1",
48
48
  "glob": "^13.0.6",
49
49
  "handlebars": "^4.7.9",
50
50
  "jiti": "^2.5.1",
51
51
  "node-stream-zip": "^1.15.0",
52
52
  "p-limit": "^7.3.0",
53
- "yaml": "^2.8.3",
53
+ "yaml": "^2.9.1",
54
54
  "yoctocolors": "^2.2.0",
55
55
  "zip-stream": "^7.0.5"
56
56
  },