@allurereport/core 3.17.0 → 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/config.d.ts CHANGED
@@ -9,11 +9,11 @@ export interface ConfigOverride {
9
9
  port?: Config["port"];
10
10
  hideLabels?: Config["hideLabels"];
11
11
  historyPath?: Config["historyPath"];
12
+ historyBaseUrl?: Config["historyBaseUrl"];
12
13
  historyLimit?: Config["historyLimit"];
13
14
  resolutions?: Pick<NonNullable<Config["resolutions"]>, "knownIssuesPath">;
14
15
  plugins?: Config["plugins"];
15
16
  }
16
- export declare const parseIntegerConfigValue: (value: unknown, defaultValue: number, minValue: number) => number;
17
17
  export declare const isAgentDescriptor: (value: string | undefined) => value is "agent" | "@allurereport/plugin-agent";
18
18
  export declare const hasConfiguredAgent: (plugins: Record<string, PluginDescriptor>) => boolean;
19
19
  export declare const assertValidPluginId: (id: string) => void;
package/dist/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFile, stat } from "node:fs/promises";
2
2
  import { extname, resolve } from "node:path";
3
3
  import * as process from "node:process";
4
- import { validateEnvironmentName } from "@allurereport/core-api";
4
+ import { parseIntegerConfigValue, validateEnvironmentName } from "@allurereport/core-api";
5
5
  import { createJiti } from "jiti";
6
6
  import { parse } from "yaml";
7
7
  import { FileSystemReportFiles } from "./plugin.js";
@@ -23,16 +23,8 @@ const CONFIG_FILENAMES = [
23
23
  "allurerc.yml",
24
24
  ];
25
25
  const DEFAULT_CONFIG = {};
26
- const DEFAULT_ALLURE_SERVICE_UPLOAD_CONCURRENCY = 100;
27
26
  const DEFAULT_ALLURE_SERVICE_UPLAOD_MAX_ATTEMPTS = 5;
28
27
  const DEFAULT_ALLURE_SERVICE_UPLOAD_MAX_SIMULTANEOUS_FAILURES = 5;
29
- export const parseIntegerConfigValue = (value, defaultValue, minValue) => {
30
- if (typeof value !== "number" || !Number.isFinite(value)) {
31
- return defaultValue;
32
- }
33
- const normalized = Math.floor(value);
34
- return normalized >= minValue ? normalized : defaultValue;
35
- };
36
28
  export const isAgentDescriptor = (value) => {
37
29
  return value === "agent" || value === "@allurereport/plugin-agent";
38
30
  };
@@ -97,6 +89,7 @@ export const validateConfig = (config) => {
97
89
  "port",
98
90
  "hideLabels",
99
91
  "historyPath",
92
+ "historyBaseUrl",
100
93
  "historyLimit",
101
94
  "resolutions",
102
95
  "plugins",
@@ -112,6 +105,7 @@ export const validateConfig = (config) => {
112
105
  "categories",
113
106
  "globalAttachments",
114
107
  "resultsDir",
108
+ "dump",
115
109
  ];
116
110
  const unsupportedFields = Object.keys(config).filter((key) => !supportedFields.includes(key));
117
111
  return {
@@ -202,7 +196,9 @@ export const resolveConfig = async (config, override = {}) => {
202
196
  const port = override.port ?? config.port ?? undefined;
203
197
  const hideLabels = override.hideLabels ?? config.hideLabels;
204
198
  const historyPath = override.historyPath ?? config.historyPath;
199
+ const historyBaseUrl = override.historyBaseUrl ?? config.historyBaseUrl;
205
200
  const historyLimit = override.historyLimit ?? config.historyLimit;
201
+ const dump = config.dump;
206
202
  const appendHistory = config.appendHistory ?? true;
207
203
  const configuredKnownIssuesPath = override.resolutions?.knownIssuesPath ?? config.resolutions?.knownIssuesPath;
208
204
  const knownIssuesPathInput = configuredKnownIssuesPath ?? (config.resolutions ? DEFAULT_KNOWN_ISSUES_PATH : undefined);
@@ -235,6 +231,7 @@ export const resolveConfig = async (config, override = {}) => {
235
231
  };
236
232
  pluginInstances = await resolvePlugins(pluginsWithAgent);
237
233
  }
234
+ const uploadConcurrency = parseIntegerConfigValue(config.allureService?.uploadConcurrency, 1);
238
235
  return {
239
236
  name,
240
237
  cwd,
@@ -250,6 +247,8 @@ export const resolveConfig = async (config, override = {}) => {
250
247
  appendHistory,
251
248
  historyLimit,
252
249
  historyPath: historyPath ? resolve(historyPath) : undefined,
250
+ historyBaseUrl,
251
+ dump,
253
252
  reportFiles: new FileSystemReportFiles(output),
254
253
  plugins: pluginInstances,
255
254
  defaultLabels: config.defaultLabels ?? {},
@@ -259,9 +258,11 @@ export const resolveConfig = async (config, override = {}) => {
259
258
  ? {
260
259
  accessToken: config.allureService.accessToken,
261
260
  private: config.allureService.private,
262
- uploadConcurrency: parseIntegerConfigValue(config.allureService.uploadConcurrency, DEFAULT_ALLURE_SERVICE_UPLOAD_CONCURRENCY, 1),
263
- uploadMaxAttempts: parseIntegerConfigValue(config.allureService.uploadMaxAttempts, DEFAULT_ALLURE_SERVICE_UPLAOD_MAX_ATTEMPTS, 1),
264
- uploadMaxSimultaneousFailures: parseIntegerConfigValue(config.allureService.uploadMaxSimultaneousFailures, DEFAULT_ALLURE_SERVICE_UPLOAD_MAX_SIMULTANEOUS_FAILURES, 0),
261
+ ...(uploadConcurrency === undefined ? {} : { uploadConcurrency }),
262
+ uploadMaxAttempts: parseIntegerConfigValue(config.allureService.uploadMaxAttempts, 1) ??
263
+ DEFAULT_ALLURE_SERVICE_UPLAOD_MAX_ATTEMPTS,
264
+ uploadMaxSimultaneousFailures: parseIntegerConfigValue(config.allureService.uploadMaxSimultaneousFailures, 0) ??
265
+ DEFAULT_ALLURE_SERVICE_UPLOAD_MAX_SIMULTANEOUS_FAILURES,
265
266
  }
266
267
  : undefined,
267
268
  categories: config.categories,
package/dist/history.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { type AllureHistory, type HistoryDataPoint, type MetricSample, type TestCase, type TestResult } from "@allurereport/core-api";
2
+ export declare const normalizeHistoryBaseUrl: (historyBaseUrl: string) => string;
3
+ export declare const setHistoryDataPointUrl: (point: HistoryDataPoint, url: string) => HistoryDataPoint;
2
4
  export declare const createHistory: (reportUuid: string, reportName: string | undefined, testCases: TestCase[], testResults: TestResult[], remoteUrl?: string, metrics?: MetricSample[]) => HistoryDataPoint;
3
5
  export declare class AllureLocalHistory implements AllureHistory {
4
6
  #private;
@@ -7,6 +9,7 @@ export declare class AllureLocalHistory implements AllureHistory {
7
9
  historyPath: string;
8
10
  limit?: number;
9
11
  });
12
+ resolveTestResultUrl(historyUrl: string, pluginId: string, historicalResultId: string): string;
10
13
  readHistory(): Promise<HistoryDataPoint[]>;
11
14
  appendHistory(data: HistoryDataPoint): Promise<void>;
12
15
  }
package/dist/history.js CHANGED
@@ -53,6 +53,28 @@ const metricsToHistoryValues = (metrics) => {
53
53
  }
54
54
  return Object.fromEntries([...grouped.entries()].map(([key, values]) => [key, values.reduce((acc, value) => acc + value, 0) / values.length]));
55
55
  };
56
+ export const normalizeHistoryBaseUrl = (historyBaseUrl) => {
57
+ let url;
58
+ try {
59
+ url = new URL(historyBaseUrl);
60
+ }
61
+ catch (cause) {
62
+ throw new Error(`Invalid historyBaseUrl ${JSON.stringify(historyBaseUrl)}: expected an absolute URL`, { cause });
63
+ }
64
+ if (url.href.includes("#")) {
65
+ throw new Error(`Invalid historyBaseUrl ${JSON.stringify(historyBaseUrl)}: fragments are not allowed`);
66
+ }
67
+ if (/\.html\/?$/iu.test(url.pathname)) {
68
+ throw new Error(`Invalid historyBaseUrl ${JSON.stringify(historyBaseUrl)}: expected a base URL, not an HTML document`);
69
+ }
70
+ url.pathname = `${url.pathname.replace(/\/+$/u, "")}/`;
71
+ return url.toString();
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
+ });
56
78
  export const createHistory = (reportUuid, reportName = "Allure Report", testCases, testResults, remoteUrl = "", metrics = []) => {
57
79
  const knownTestCaseIds = testCases.map((tc) => tc.id);
58
80
  return {
@@ -138,6 +160,17 @@ export class AllureLocalHistory {
138
160
  `doesn't match the actual number ${actualBytes}`);
139
161
  });
140
162
  }
163
+ resolveTestResultUrl(historyUrl, pluginId, historicalResultId) {
164
+ if (!historyUrl) {
165
+ return "";
166
+ }
167
+ const url = new URL(historyUrl);
168
+ if (url.pathname.endsWith("/")) {
169
+ url.pathname = `${url.pathname}${pluginId}/index.html`;
170
+ }
171
+ url.hash = historicalResultId;
172
+ return url.toString();
173
+ }
141
174
  async readHistory() {
142
175
  if (__classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").length > 0) {
143
176
  return __classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f");
@@ -174,15 +207,14 @@ export class AllureLocalHistory {
174
207
  const { limit } = this.params;
175
208
  await mkdir(parentDir, { recursive: true });
176
209
  const { file: historyFile, exists: historyExists } = await __classPrivateFieldGet(this, _AllureLocalHistory_ensureFileOpenedToAppend, "f").call(this, fullPath);
210
+ let dst;
177
211
  try {
178
- const dst = historyFile.createWriteStream({ encoding: "utf-8", start: 0, autoClose: false });
179
- if (limit === 0 && historyExists) {
180
- await historyFile.truncate(0);
181
- return;
182
- }
183
- if (limit === 0 && !historyExists) {
212
+ if (limit === 0) {
213
+ if (historyExists)
214
+ await historyFile.truncate(0);
184
215
  return;
185
216
  }
217
+ dst = historyFile.createWriteStream({ encoding: "utf-8", start: 0, autoClose: false });
186
218
  if (historyExists) {
187
219
  const start = await __classPrivateFieldGet(this, _AllureLocalHistory_findFirstEntryAddress, "f").call(this, historyFile, limit ? limit - 1 : undefined);
188
220
  const src = historyFile.createReadStream({ start, autoClose: false });
@@ -195,7 +227,9 @@ export class AllureLocalHistory {
195
227
  }
196
228
  }
197
229
  finally {
198
- await historyFile.close();
230
+ const closing = historyFile.close();
231
+ dst?.destroy();
232
+ await closing;
199
233
  if (limit !== 0) {
200
234
  __classPrivateFieldGet(this, _AllureLocalHistory_cachedHistory, "f").push(normalizedData);
201
235
  }
package/dist/index.d.ts CHANGED
@@ -11,4 +11,4 @@ export * from "./resolutions.js";
11
11
  export { resolveConfig, readConfig, readRawConfig, getPluginInstance } from "./config.js";
12
12
  export * from "./report.js";
13
13
  export * from "./plugin.js";
14
- export { QualityGateState, qualityGateDefaultRules, maxFailuresRule, minTestsCountRule, successRateRule, maxDurationRule, allTestsContainEnvRule, environmentsTestedRule, metricMaxRule, metricMinRule, metricMaxDeltaRule, metricMaxDeltaPercentRule, convertQualityGateResultsToTestErrors, stringifyQualityGateResults, } from "./qualityGate/index.js";
14
+ export { QualityGateState, qualityGateDefaultRules, maxFailuresRule, minTestsCountRule, successRateRule, maxDurationRule, allTestsContainEnvRule, environmentsTestedRule, metricMaxRule, metricMinRule, metricMaxDeltaRule, metricMaxDeltaPercentRule, convertQualityGateResultsToTestErrors, filterFailedQualityGateResults, stringifyQualityGateResults, } from "./qualityGate/index.js";
package/dist/index.js CHANGED
@@ -10,4 +10,4 @@ export * from "./resolutions.js";
10
10
  export { resolveConfig, readConfig, readRawConfig, getPluginInstance } from "./config.js";
11
11
  export * from "./report.js";
12
12
  export * from "./plugin.js";
13
- export { QualityGateState, qualityGateDefaultRules, maxFailuresRule, minTestsCountRule, successRateRule, maxDurationRule, allTestsContainEnvRule, environmentsTestedRule, metricMaxRule, metricMinRule, metricMaxDeltaRule, metricMaxDeltaPercentRule, convertQualityGateResultsToTestErrors, stringifyQualityGateResults, } from "./qualityGate/index.js";
13
+ export { QualityGateState, qualityGateDefaultRules, maxFailuresRule, minTestsCountRule, successRateRule, maxDurationRule, allTestsContainEnvRule, environmentsTestedRule, metricMaxRule, metricMinRule, metricMaxDeltaRule, metricMaxDeltaPercentRule, convertQualityGateResultsToTestErrors, filterFailedQualityGateResults, stringifyQualityGateResults, } from "./qualityGate/index.js";
@@ -1,5 +1,6 @@
1
1
  import { type MetricSample, type TestError, type TestResult } from "@allurereport/core-api";
2
2
  import type { QualityGateConfig, QualityGateMetricHistoryPoint, QualityGateValidationResult } from "@allurereport/plugin-api";
3
+ export declare const filterFailedQualityGateResults: (results: QualityGateValidationResult[]) => QualityGateValidationResult[];
3
4
  export declare const stringifyQualityGateResults: (results: QualityGateValidationResult[]) => string;
4
5
  export declare const convertQualityGateResultsToTestErrors: (results: QualityGateValidationResult[]) => TestError[];
5
6
  export declare class QualityGateState {
@@ -4,25 +4,29 @@ 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 _QualityGateState_state, _QualityGateState_processedTestResultIds;
7
- import { gray, red } from "yoctocolors";
7
+ import { bold, gray, red } from "yoctocolors";
8
8
  import { isIgnoredFailure } from "../resolutions.js";
9
9
  import { qualityGateDefaultRules } from "./rules.js";
10
+ export const filterFailedQualityGateResults = (results) => results.filter(({ success }) => !success);
11
+ const formatQualityGateValue = (value) => (Array.isArray(value) ? value.join(", ") : String(value));
12
+ const defaultSuccessMessage = ({ actual, expected }) => `The rule has been passed; actual ${bold(formatQualityGateValue(actual))}, expected ${bold(formatQualityGateValue(expected))}`;
10
13
  export const stringifyQualityGateResults = (results) => {
11
- if (results.length === 0) {
14
+ const failedResults = filterFailedQualityGateResults(results);
15
+ if (failedResults.length === 0) {
12
16
  return "";
13
17
  }
14
18
  const lines = [red("Quality Gate failed with following issues:")];
15
- const maxMessageLength = Math.max(...results.map((r) => r.message.length));
19
+ const maxMessageLength = Math.max(...failedResults.map((r) => r.message.length));
16
20
  lines.push("");
17
- results.forEach((result) => {
21
+ failedResults.forEach((result) => {
18
22
  lines.push(` ${red("⨯")} ${result.message.padEnd(maxMessageLength, " ")} ${gray(result.rule)}`);
19
23
  });
20
24
  lines.push("");
21
- lines.push(red(`${results.length} quality gate rules have been failed.`));
25
+ lines.push(red(`${failedResults.length} quality gate rules have been failed.`));
22
26
  return lines.join("\n");
23
27
  };
24
28
  export const convertQualityGateResultsToTestErrors = (results) => {
25
- return results.map((result) => ({
29
+ return filterFailedQualityGateResults(results).map((result) => ({
26
30
  message: `Quality Gate (${result.rule}): ${result.message}`,
27
31
  actual: result.actual,
28
32
  expected: result.expected,
@@ -102,21 +106,21 @@ export class QualityGate {
102
106
  previousHistory,
103
107
  environment,
104
108
  });
105
- if (result.success) {
106
- continue;
107
- }
109
+ const messagePayload = {
110
+ actual: result.actual,
111
+ expected,
112
+ };
108
113
  results.push({
109
114
  ...result,
110
115
  expected,
111
116
  rule: ruleId,
112
- message: rule.message({
113
- actual: result.actual,
114
- expected,
115
- }),
117
+ message: result.success
118
+ ? (rule.successMessage ?? defaultSuccessMessage)(messagePayload)
119
+ : rule.message(messagePayload),
116
120
  environment,
117
121
  testResults: [...new Set([...(state?.getTestResults(ruleId) ?? []), ...result.testResults])],
118
122
  });
119
- if (ruleset.fastFail) {
123
+ if (!result.success && ruleset.fastFail) {
120
124
  fastFailed = true;
121
125
  break;
122
126
  }
@@ -1,4 +1,4 @@
1
- import { filterSuccessful, filterUnsuccessful } from "@allurereport/core-api";
1
+ import { filterIncludedInSuccessRate, filterSuccessful, filterUnsuccessful, getSuccessRate, } from "@allurereport/core-api";
2
2
  import { bold } from "yoctocolors";
3
3
  const numberStateValue = (value) => (Number.isFinite(value) ? Number(value) : 0);
4
4
  const stringArrayStateValue = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
@@ -73,6 +73,7 @@ const metricDeltaWithinThreshold = (delta, threshold, better) => {
73
73
  export const maxFailuresRule = {
74
74
  rule: "maxFailures",
75
75
  message: ({ actual, expected }) => `The number of failed tests ${bold(String(actual))} exceeds the allowed threshold value ${bold(String(expected))}`,
76
+ successMessage: ({ actual, expected }) => `The number of failed tests ${bold(String(actual))} is within the allowed threshold value ${bold(String(expected))}`,
76
77
  validate: async ({ trs, expected, state }) => {
77
78
  const previous = numberStateValue(state.getResult());
78
79
  const failedTrs = trs.filter(filterUnsuccessful);
@@ -89,6 +90,7 @@ export const maxFailuresRule = {
89
90
  export const minTestsCountRule = {
90
91
  rule: "minTestsCount",
91
92
  message: ({ actual, expected }) => `The total number of tests ${bold(String(actual))} is less than the expected threshold value ${bold(String(expected))}`,
93
+ successMessage: ({ actual, expected }) => `The total number of tests ${bold(String(actual))} meets the expected threshold value ${bold(String(expected))}`,
92
94
  validate: async ({ trs, expected, state }) => {
93
95
  const actual = trs.length + numberStateValue(state.getResult());
94
96
  state.setResult(actual, []);
@@ -102,14 +104,16 @@ export const minTestsCountRule = {
102
104
  export const successRateRule = {
103
105
  rule: "successRate",
104
106
  message: ({ actual, expected }) => `Success rate ${bold(String(actual))} is less, than expected ${bold(String(expected))}`,
107
+ successMessage: ({ actual, expected }) => `Success rate ${bold(String(actual))} is not less, than expected ${bold(String(expected))}`,
105
108
  validate: async ({ trs, expected, state }) => {
106
109
  const previous = successRateStateValue(state.getResult());
107
- const passedTrs = trs.filter(filterSuccessful);
108
- const notPassedTrs = trs.filter((tr) => !filterSuccessful(tr));
109
- const totalCount = previous.totalCount + trs.length;
110
+ const eligibleTrs = trs.filter(filterIncludedInSuccessRate);
111
+ const passedTrs = eligibleTrs.filter(filterSuccessful);
112
+ const notPassedTrs = eligibleTrs.filter(filterUnsuccessful);
113
+ const totalCount = previous.totalCount + eligibleTrs.length;
110
114
  const passedCount = previous.passedCount + passedTrs.length;
111
115
  const testResults = notPassedTrs.map((tr) => tr.id);
112
- const rate = totalCount === 0 ? 0 : passedCount / totalCount;
116
+ const rate = getSuccessRate({ passed: passedCount, failed: totalCount - passedCount });
113
117
  state.setResult({ totalCount, passedCount }, testResults);
114
118
  return {
115
119
  success: rate >= expected,
@@ -121,6 +125,7 @@ export const successRateRule = {
121
125
  export const maxDurationRule = {
122
126
  rule: "maxDuration",
123
127
  message: ({ actual, expected }) => `Maximum duration of some tests exceed the defined limit; actual ${bold(String(actual))}, expected ${bold(String(expected))}`,
128
+ successMessage: ({ actual, expected }) => `Maximum duration of the tests is within the defined limit; actual ${bold(String(actual))}, expected ${bold(String(expected))}`,
124
129
  validate: async ({ trs, expected, state }) => {
125
130
  const previous = numberStateValue(state.getResult());
126
131
  const actual = Math.max(previous, ...trs.map((tr) => tr.duration ?? 0));
@@ -137,6 +142,7 @@ export const maxDurationRule = {
137
142
  export const allTestsContainEnvRule = {
138
143
  rule: "allTestsContainEnv",
139
144
  message: ({ actual, expected }) => `Not all tests contain the required "${bold(expected)}" environment, ${bold(String(actual))} tests have different or missing environment`,
145
+ successMessage: ({ expected }) => `All tests contain the required "${bold(expected)}" environment`,
140
146
  validate: async ({ trs, expected, state }) => {
141
147
  const previous = numberStateValue(state.getResult());
142
148
  const testsWithoutEnv = trs.filter((tr) => (tr.environment ?? "") !== expected);
@@ -153,6 +159,7 @@ export const allTestsContainEnvRule = {
153
159
  export const environmentsTestedRule = {
154
160
  rule: "environmentsTested",
155
161
  message: ({ actual, expected }) => `The following environments were not tested: "${actual.join('", "')}"; expected all of: "${expected.join('", "')}"`,
162
+ successMessage: ({ expected }) => `All expected environments were tested: "${expected.join('", "')}"`,
156
163
  validate: async ({ trs, expected, state }) => {
157
164
  const previouslyTested = new Set(stringArrayStateValue(state.getResult()));
158
165
  const batchTested = trs.map((tr) => tr.environment).filter((env) => env != null && env !== "");
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
- return createHistory(this.reportUuid, this.reportName, allTcs, allTrs, this.reportUrl, await __classPrivateFieldGet(this, _AllureReport_store, "f").allMetrics());
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()) {
@@ -813,6 +844,7 @@ export class AllureReport {
813
844
  await this.dumpState();
814
845
  return;
815
846
  }
847
+ await __classPrivateFieldGet(this, _AllureReport_resolveHistoryReportUrl, "f").call(this);
816
848
  await measurePerf(PERF_METRIC_NAMES.generatePluginsDone, async () => {
817
849
  await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
818
850
  await measurePerf(`${PERF_METRIC_PREFIXES.generatePluginDone}${context.id}`, async () => {
@@ -853,7 +885,15 @@ export class AllureReport {
853
885
  }
854
886
  const outputEntries = await Promise.all(outputDirFiles.map(async (file) => ({ file, stats: await lstat(join(__classPrivateFieldGet(this, _AllureReport_output, "f"), file)) })));
855
887
  const outputDirectoryEntries = outputEntries.filter(({ stats }) => stats.isDirectory());
856
- if (outputDirectoryEntries.length === 1) {
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) {
857
897
  const reportPath = join(__classPrivateFieldGet(this, _AllureReport_output, "f"), outputDirectoryEntries[0].file);
858
898
  const reportContent = await readdir(reportPath);
859
899
  for (const entry of reportContent) {
@@ -965,12 +1005,13 @@ export class AllureReport {
965
1005
  }
966
1006
  }
967
1007
  });
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;
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;
969
1009
  const allureServiceAccessToken = allureService?.accessToken;
970
1010
  if (allureServiceAccessToken) {
971
1011
  const allureServiceClientConfig = {
972
1012
  ...allureService,
973
1013
  accessToken: allureServiceAccessToken,
1014
+ uploadConcurrency: parseIntegerConfigValue(allureService.uploadConcurrency, 1) ?? DEFAULT_UPLOAD_CONCURRENCY,
974
1015
  };
975
1016
  __classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceAccessToken.startsWith("ato1.")
976
1017
  ? new AllureTestOpsClient(allureServiceClientConfig)
@@ -996,6 +1037,7 @@ export class AllureReport {
996
1037
  __classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
997
1038
  }
998
1039
  __classPrivateFieldSet(this, _AllureReport_categories, normalizeCategoriesConfig(categories), "f");
1040
+ __classPrivateFieldSet(this, _AllureReport_historyBaseUrl, !__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && historyPath && historyBaseUrl ? normalizeHistoryBaseUrl(historyBaseUrl) : undefined, "f");
999
1041
  if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
1000
1042
  __classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
1001
1043
  limit: historyLimit,
@@ -1039,6 +1081,6 @@ export class AllureReport {
1039
1081
  return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
1040
1082
  }
1041
1083
  }
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) {
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) {
1043
1085
  return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
1044
1086
  };
@@ -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>;
@@ -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 ((testResult.status !== "failed" && testResult.status !== "broken") || !config?.rules.length) {
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 ["issue", "muted", "accepted"]) {
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;
@@ -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,
@@ -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 _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_environmentDisplayNames, _DefaultAllureStore_environmentNameToId, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_resolutionsConfig, _DefaultAllureStore_resolutionIssues, _DefaultAllureStore_testResultIdsByResolutionIssueId, _DefaultAllureStore_resolutionIssueIdByTestResultId, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_allowedEnvironmentIds, _DefaultAllureStore_retrySubstore, _DefaultAllureStore_testResultIdsByEnvironmentId, _DefaultAllureStore_cachedEnvironmentEntries, _DefaultAllureStore_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResultsById, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_metrics, _DefaultAllureStore_performance, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignRetryHash, _DefaultAllureStore_classifyResolution, _DefaultAllureStore_associateResolutionIssue, _DefaultAllureStore_removeResolutionIssueAssociation, _DefaultAllureStore_rebuildRetrySubstore, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps, _DefaultAllureStore_retriesByTr, _DefaultAllureStore_historyByTr;
12
+ var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_environmentDisplayNames, _DefaultAllureStore_environmentNameToId, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_resolutionsConfig, _DefaultAllureStore_resolutionIssues, _DefaultAllureStore_testResultIdsByResolutionIssueId, _DefaultAllureStore_resolutionIssueIdByTestResultId, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_allowedEnvironmentIds, _DefaultAllureStore_retrySubstore, _DefaultAllureStore_testResultIdsByEnvironmentId, _DefaultAllureStore_cachedEnvironmentEntries, _DefaultAllureStore_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_processGlobalAttachmentIds, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, _DefaultAllureStore_processGlobalErrors, _DefaultAllureStore_processGlobalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResultsById, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_metrics, _DefaultAllureStore_performance, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignRetryHash, _DefaultAllureStore_classifyResolution, _DefaultAllureStore_associateResolutionIssue, _DefaultAllureStore_removeResolutionIssueAssociation, _DefaultAllureStore_rebuildRetrySubstore, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_processGlobalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_resetProcessGlobals, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps, _DefaultAllureStore_retriesByTr, _DefaultAllureStore_historyByTr;
13
13
  import { extname } from "node:path";
14
14
  import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary, getHistoryIdCandidates, getWorstStatus, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
15
15
  import { md5, } from "@allurereport/plugin-api";
@@ -89,6 +89,10 @@ export class DefaultAllureStore {
89
89
  _DefaultAllureStore_globalAttachmentIdsByEnv.set(this, new Map());
90
90
  _DefaultAllureStore_globalErrors.set(this, []);
91
91
  _DefaultAllureStore_globalErrorsByEnv.set(this, new Map());
92
+ _DefaultAllureStore_processGlobalAttachmentIds.set(this, []);
93
+ _DefaultAllureStore_processGlobalAttachmentIdsByEnv.set(this, new Map());
94
+ _DefaultAllureStore_processGlobalErrors.set(this, []);
95
+ _DefaultAllureStore_processGlobalErrorsByEnv.set(this, new Map());
92
96
  _DefaultAllureStore_globalExitCode.set(this, void 0);
93
97
  _DefaultAllureStore_checkResultsById.set(this, new Map());
94
98
  _DefaultAllureStore_qualityGateResults.set(this, []);
@@ -180,6 +184,32 @@ export class DefaultAllureStore {
180
184
  };
181
185
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addGlobalAttachment).call(this, attachmentLink, attachment);
182
186
  });
187
+ __classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onProcessGlobalError?.((error) => {
188
+ const resolvedEnvironment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resolveGlobalEnvironmentIdentity).call(this, error.environment);
189
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addGlobalError).call(this, {
190
+ ...error,
191
+ environment: resolvedEnvironment.id,
192
+ }, __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f"), __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrorsByEnv, "f"));
193
+ });
194
+ __classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onProcessGlobalAttachment?.(({ attachment, fileName, environment }) => {
195
+ const originalFileName = attachment.getOriginalFileName();
196
+ const resolvedEnvironment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resolveGlobalEnvironmentIdentity).call(this, environment);
197
+ const attachmentLink = {
198
+ id: __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_processGlobalAttachmentId).call(this, originalFileName, resolvedEnvironment.id),
199
+ name: fileName || originalFileName,
200
+ missed: false,
201
+ used: true,
202
+ ext: attachment.getExtension(),
203
+ contentType: attachment.getContentType(),
204
+ contentLength: attachment.getContentLength(),
205
+ originalFileName,
206
+ environment: resolvedEnvironment.id,
207
+ };
208
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addGlobalAttachment).call(this, attachmentLink, attachment, __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f"), __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, "f"));
209
+ });
210
+ __classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onProcessGlobalsReset?.(() => {
211
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resetProcessGlobals).call(this);
212
+ });
183
213
  }
184
214
  async readHistory() {
185
215
  if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
@@ -261,13 +291,19 @@ export class DefaultAllureStore {
261
291
  return __classPrivateFieldGet(this, _DefaultAllureStore_globalExitCode, "f");
262
292
  }
263
293
  async allGlobalErrors() {
264
- return __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f");
294
+ return [...__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f")];
265
295
  }
266
296
  async allGlobalErrorsByEnv() {
267
- return mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_globalErrorsByEnv, "f"));
297
+ const result = {};
298
+ for (const errorsByEnv of [__classPrivateFieldGet(this, _DefaultAllureStore_globalErrorsByEnv, "f"), __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrorsByEnv, "f")]) {
299
+ errorsByEnv.forEach((errors, environmentId) => {
300
+ result[environmentId] = [...(result[environmentId] ?? []), ...errors];
301
+ });
302
+ }
303
+ return result;
268
304
  }
269
305
  async allGlobalAttachments() {
270
- return __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").reduce((acc, id) => {
306
+ return [...__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")].reduce((acc, id) => {
271
307
  const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
272
308
  if (!attachment) {
273
309
  return acc;
@@ -278,16 +314,19 @@ export class DefaultAllureStore {
278
314
  }
279
315
  async allGlobalAttachmentsByEnv() {
280
316
  const result = {};
281
- __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIdsByEnv, "f").forEach((attachmentIds, environmentId) => {
282
- result[environmentId] = attachmentIds.reduce((acc, id) => {
283
- const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
284
- if (!attachment) {
317
+ for (const attachmentIdsByEnv of [__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIdsByEnv, "f"), __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, "f")]) {
318
+ attachmentIdsByEnv.forEach((attachmentIds, environmentId) => {
319
+ const attachments = attachmentIds.reduce((acc, id) => {
320
+ const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
321
+ if (!attachment) {
322
+ return acc;
323
+ }
324
+ acc.push(attachment);
285
325
  return acc;
286
- }
287
- acc.push(attachment);
288
- return acc;
289
- }, []);
290
- });
326
+ }, []);
327
+ result[environmentId] = [...(result[environmentId] ?? []), ...attachments];
328
+ });
329
+ }
291
330
  return result;
292
331
  }
293
332
  async visitCheckResult(result) {
@@ -387,7 +426,7 @@ export class DefaultAllureStore {
387
426
  contentLength: resultFile.getContentLength(),
388
427
  });
389
428
  }
390
- for (const globalAttachmentId of __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f")) {
429
+ for (const globalAttachmentId of [...__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")]) {
391
430
  const globalAttachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(globalAttachmentId);
392
431
  if (!globalAttachment || globalAttachment.originalFileName !== originalFileName) {
393
432
  continue;
@@ -828,8 +867,8 @@ export class DefaultAllureStore {
828
867
  fixtures: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f")),
829
868
  environments: __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"),
830
869
  reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
831
- globalAttachmentIds: __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"),
832
- globalErrors: __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"),
870
+ globalAttachmentIds: [...__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")],
871
+ globalErrors: [...__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f")],
833
872
  checkResults: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_checkResultsById, "f")),
834
873
  indexAttachmentByTestResult: {},
835
874
  indexTestResultByHistoryId: {},
@@ -1030,13 +1069,8 @@ export class DefaultAllureStore {
1030
1069
  existingFixtures.push(...fxs);
1031
1070
  });
1032
1071
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildRetrySubstore).call(this);
1033
- if (__classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f")) {
1034
- __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").clear();
1035
- __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").clear();
1036
- __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").clear();
1037
- for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
1038
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
1039
- }
1072
+ for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
1073
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
1040
1074
  }
1041
1075
  qualityGateResults.forEach((result, index) => {
1042
1076
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedStoredEnvironment).call(this, {
@@ -1050,7 +1084,7 @@ export class DefaultAllureStore {
1050
1084
  __classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f").push(...metrics);
1051
1085
  }
1052
1086
  }
1053
- _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environmentDisplayNames = new WeakMap(), _DefaultAllureStore_environmentNameToId = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_resolutionsConfig = new WeakMap(), _DefaultAllureStore_resolutionIssues = new WeakMap(), _DefaultAllureStore_testResultIdsByResolutionIssueId = new WeakMap(), _DefaultAllureStore_resolutionIssueIdByTestResultId = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environment = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_allowedEnvironmentIds = new WeakMap(), _DefaultAllureStore_retrySubstore = new WeakMap(), _DefaultAllureStore_testResultIdsByEnvironmentId = new WeakMap(), _DefaultAllureStore_cachedEnvironmentEntries = new WeakMap(), _DefaultAllureStore_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalErrorsByEnv = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_checkResultsById = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_metrics = new WeakMap(), _DefaultAllureStore_performance = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
1087
+ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environmentDisplayNames = new WeakMap(), _DefaultAllureStore_environmentNameToId = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_resolutionsConfig = new WeakMap(), _DefaultAllureStore_resolutionIssues = new WeakMap(), _DefaultAllureStore_testResultIdsByResolutionIssueId = new WeakMap(), _DefaultAllureStore_resolutionIssueIdByTestResultId = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environment = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_allowedEnvironmentIds = new WeakMap(), _DefaultAllureStore_retrySubstore = new WeakMap(), _DefaultAllureStore_testResultIdsByEnvironmentId = new WeakMap(), _DefaultAllureStore_cachedEnvironmentEntries = new WeakMap(), _DefaultAllureStore_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalErrorsByEnv = new WeakMap(), _DefaultAllureStore_processGlobalAttachmentIds = new WeakMap(), _DefaultAllureStore_processGlobalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_processGlobalErrors = new WeakMap(), _DefaultAllureStore_processGlobalErrorsByEnv = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_checkResultsById = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_metrics = new WeakMap(), _DefaultAllureStore_performance = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
1054
1088
  const configuredEnvironment = environmentIdentityById(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), incomingEnvironment.id);
1055
1089
  if (configuredEnvironment) {
1056
1090
  return configuredEnvironment;
@@ -1154,14 +1188,15 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1154
1188
  testResult.retryHash = calculateRetryHash(testResult.testCase?.id, parametersHash, environmentId);
1155
1189
  }, _DefaultAllureStore_classifyResolution = function _DefaultAllureStore_classifyResolution(testResult) {
1156
1190
  const rule = getResolutionByRules(testResult, __classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f"));
1157
- testResult.resolution = rule?.resolution;
1158
- testResult.resolutionComment = rule?.comment;
1159
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResult.id);
1160
- if (rule?.resolution !== "issue") {
1191
+ if (!rule?.resolution) {
1161
1192
  return;
1162
1193
  }
1163
- const resolutionIssue = { ...rule.issue, comment: rule.comment };
1164
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, resolutionIssue, testResult.id);
1194
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResult.id);
1195
+ testResult.resolution = rule.resolution;
1196
+ testResult.resolutionComment = rule.comment;
1197
+ if (rule.resolution === "issue") {
1198
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, { ...rule.issue, comment: rule.comment }, testResult.id);
1199
+ }
1165
1200
  }, _DefaultAllureStore_associateResolutionIssue = function _DefaultAllureStore_associateResolutionIssue(resolutionIssue, testResultId) {
1166
1201
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResultId);
1167
1202
  __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").set(resolutionIssue.id, resolutionIssue);
@@ -1208,30 +1243,41 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1208
1243
  return DEFAULT_ENVIRONMENT_IDENTITY;
1209
1244
  }, _DefaultAllureStore_globalAttachmentId = function _DefaultAllureStore_globalAttachmentId(originalFileName, environmentId) {
1210
1245
  return md5(environmentId ? `${environmentId}:${originalFileName}` : originalFileName);
1211
- }, _DefaultAllureStore_indexGlobalError = function _DefaultAllureStore_indexGlobalError(error) {
1246
+ }, _DefaultAllureStore_processGlobalAttachmentId = function _DefaultAllureStore_processGlobalAttachmentId(originalFileName, environmentId) {
1247
+ return md5(`process:${environmentId}:${originalFileName}`);
1248
+ }, _DefaultAllureStore_indexGlobalError = function _DefaultAllureStore_indexGlobalError(error, errorsByEnv = __classPrivateFieldGet(this, _DefaultAllureStore_globalErrorsByEnv, "f")) {
1212
1249
  const resolvedEnvironment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resolveGlobalEnvironmentIdentity).call(this, error.environment);
1213
1250
  if (!resolvedEnvironment) {
1214
1251
  return error;
1215
1252
  }
1216
1253
  error.environment = resolvedEnvironment.name;
1217
1254
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, [resolvedEnvironment]);
1218
- index(__classPrivateFieldGet(this, _DefaultAllureStore_globalErrorsByEnv, "f"), resolvedEnvironment.id, error);
1255
+ index(errorsByEnv, resolvedEnvironment.id, error);
1219
1256
  return error;
1220
- }, _DefaultAllureStore_addGlobalError = function _DefaultAllureStore_addGlobalError(error) {
1221
- __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalError).call(this, error));
1222
- }, _DefaultAllureStore_indexGlobalAttachment = function _DefaultAllureStore_indexGlobalAttachment(attachmentLink) {
1257
+ }, _DefaultAllureStore_addGlobalError = function _DefaultAllureStore_addGlobalError(error, errors = __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"), errorsByEnv = __classPrivateFieldGet(this, _DefaultAllureStore_globalErrorsByEnv, "f")) {
1258
+ errors.push(__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalError).call(this, error, errorsByEnv));
1259
+ }, _DefaultAllureStore_indexGlobalAttachment = function _DefaultAllureStore_indexGlobalAttachment(attachmentLink, attachmentIdsByEnv = __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIdsByEnv, "f")) {
1223
1260
  const resolvedEnvironment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resolveGlobalEnvironmentIdentity).call(this, attachmentLink.environment);
1224
1261
  attachmentLink.environment = resolvedEnvironment.name;
1225
1262
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, [resolvedEnvironment]);
1226
- index(__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIdsByEnv, "f"), resolvedEnvironment.id, attachmentLink.id);
1263
+ index(attachmentIdsByEnv, resolvedEnvironment.id, attachmentLink.id);
1227
1264
  return attachmentLink;
1228
- }, _DefaultAllureStore_addGlobalAttachment = function _DefaultAllureStore_addGlobalAttachment(attachmentLink, attachment) {
1229
- const indexedAttachment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalAttachment).call(this, { ...attachmentLink });
1265
+ }, _DefaultAllureStore_addGlobalAttachment = function _DefaultAllureStore_addGlobalAttachment(attachmentLink, attachment, attachmentIds = __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), attachmentIdsByEnv = __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIdsByEnv, "f")) {
1266
+ const indexedAttachment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalAttachment).call(this, { ...attachmentLink }, attachmentIdsByEnv);
1230
1267
  __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").set(indexedAttachment.id, indexedAttachment);
1231
1268
  if (attachment) {
1232
1269
  __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(indexedAttachment.id, attachment);
1233
1270
  }
1234
- __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").push(indexedAttachment.id);
1271
+ attachmentIds.push(indexedAttachment.id);
1272
+ }, _DefaultAllureStore_resetProcessGlobals = function _DefaultAllureStore_resetProcessGlobals() {
1273
+ for (const id of __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")) {
1274
+ __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").delete(id);
1275
+ __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").delete(id);
1276
+ }
1277
+ __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f").length = 0;
1278
+ __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, "f").clear();
1279
+ __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f").length = 0;
1280
+ __classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrorsByEnv, "f").clear();
1235
1281
  }, _DefaultAllureStore_restoreAttachmentContent = function _DefaultAllureStore_restoreAttachmentContent(id, content) {
1236
1282
  const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
1237
1283
  __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, content);
@@ -7,6 +7,9 @@ export declare enum RealtimeEvents {
7
7
  QualityGateResults = "qualityGateResults",
8
8
  GlobalAttachment = "globalAttachment",
9
9
  GlobalError = "globalError",
10
+ ProcessGlobalAttachment = "processGlobalAttachment",
11
+ ProcessGlobalError = "processGlobalError",
12
+ ProcessGlobalsReset = "processGlobalsReset",
10
13
  GlobalExitCode = "globalExitCode"
11
14
  }
12
15
  export interface AllureStoreEvents {
@@ -19,15 +22,25 @@ export interface AllureStoreEvents {
19
22
  fileName?: string;
20
23
  environment?: string;
21
24
  }];
25
+ [RealtimeEvents.ProcessGlobalAttachment]: [{
26
+ attachment: ResultFile;
27
+ fileName?: string;
28
+ environment?: string;
29
+ }];
22
30
  [RealtimeEvents.GlobalExitCode]: [ExitCode];
23
31
  [RealtimeEvents.GlobalError]: [PluginGlobalError];
32
+ [RealtimeEvents.ProcessGlobalError]: [PluginGlobalError];
33
+ [RealtimeEvents.ProcessGlobalsReset]: [];
24
34
  }
25
35
  export declare class RealtimeEventsDispatcher implements RealtimeEventsDispatcherType {
26
36
  #private;
27
37
  constructor(emitter: EventEmitter<AllureStoreEvents>);
28
38
  sendGlobalAttachment(attachment: ResultFile, fileName?: string, environment?: string): void;
39
+ sendProcessGlobalAttachment(attachment: ResultFile, fileName?: string, environment?: string): void;
29
40
  sendGlobalExitCode(codes: ExitCode): void;
30
41
  sendGlobalError(error: PluginGlobalError): void;
42
+ sendProcessGlobalError(error: PluginGlobalError): void;
43
+ sendProcessGlobalsReset(): void;
31
44
  sendQualityGateResults(payload: QualityGateValidationResult[]): void;
32
45
  sendTestResult(trId: string): void;
33
46
  sendTestFixtureResult(tfrId: string): void;
@@ -41,8 +54,15 @@ export declare class RealtimeSubscriber implements RealtimeSubscriberType {
41
54
  fileName?: string;
42
55
  environment?: string;
43
56
  }) => RealtimeListenerResult): () => void;
57
+ onProcessGlobalAttachment(listener: (payload: {
58
+ attachment: ResultFile;
59
+ fileName?: string;
60
+ environment?: string;
61
+ }) => RealtimeListenerResult): () => void;
44
62
  onGlobalExitCode(listener: (payload: ExitCode) => RealtimeListenerResult): () => void;
45
63
  onGlobalError(listener: (error: PluginGlobalError) => RealtimeListenerResult): () => void;
64
+ onProcessGlobalError(listener: (error: PluginGlobalError) => RealtimeListenerResult): () => void;
65
+ onProcessGlobalsReset(listener: () => RealtimeListenerResult): () => void;
46
66
  onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => RealtimeListenerResult): () => void;
47
67
  onTestResults(listener: (trIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
48
68
  onTestFixtureResults(listener: (tfrIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
@@ -20,6 +20,9 @@ export var RealtimeEvents;
20
20
  RealtimeEvents["QualityGateResults"] = "qualityGateResults";
21
21
  RealtimeEvents["GlobalAttachment"] = "globalAttachment";
22
22
  RealtimeEvents["GlobalError"] = "globalError";
23
+ RealtimeEvents["ProcessGlobalAttachment"] = "processGlobalAttachment";
24
+ RealtimeEvents["ProcessGlobalError"] = "processGlobalError";
25
+ RealtimeEvents["ProcessGlobalsReset"] = "processGlobalsReset";
23
26
  RealtimeEvents["GlobalExitCode"] = "globalExitCode";
24
27
  })(RealtimeEvents || (RealtimeEvents = {}));
25
28
  const runListener = (listener, ...args) => {
@@ -44,12 +47,21 @@ export class RealtimeEventsDispatcher {
44
47
  sendGlobalAttachment(attachment, fileName, environment) {
45
48
  __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalAttachment, { attachment, fileName, environment });
46
49
  }
50
+ sendProcessGlobalAttachment(attachment, fileName, environment) {
51
+ __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.ProcessGlobalAttachment, { attachment, fileName, environment });
52
+ }
47
53
  sendGlobalExitCode(codes) {
48
54
  __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalExitCode, codes);
49
55
  }
50
56
  sendGlobalError(error) {
51
57
  __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalError, error);
52
58
  }
59
+ sendProcessGlobalError(error) {
60
+ __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.ProcessGlobalError, error);
61
+ }
62
+ sendProcessGlobalsReset() {
63
+ __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.ProcessGlobalsReset);
64
+ }
53
65
  sendQualityGateResults(payload) {
54
66
  __classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.QualityGateResults, payload ?? []);
55
67
  }
@@ -74,12 +86,21 @@ export class RealtimeSubscriber {
74
86
  onGlobalAttachment(listener) {
75
87
  return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalAttachment, listener);
76
88
  }
89
+ onProcessGlobalAttachment(listener) {
90
+ return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.ProcessGlobalAttachment, listener);
91
+ }
77
92
  onGlobalExitCode(listener) {
78
93
  return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalExitCode, listener);
79
94
  }
80
95
  onGlobalError(listener) {
81
96
  return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalError, listener);
82
97
  }
98
+ onProcessGlobalError(listener) {
99
+ return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.ProcessGlobalError, listener);
100
+ }
101
+ onProcessGlobalsReset(listener) {
102
+ return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.ProcessGlobalsReset, listener);
103
+ }
83
104
  onQualityGateResults(listener) {
84
105
  return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.QualityGateResults, listener);
85
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,33 +25,33 @@
25
25
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
26
26
  },
27
27
  "dependencies": {
28
- "@allurereport/ci": "3.17.0",
29
- "@allurereport/cli-commons": "3.17.0",
30
- "@allurereport/core-api": "3.17.0",
31
- "@allurereport/plugin-agent": "3.17.0",
32
- "@allurereport/plugin-allure2": "3.17.0",
33
- "@allurereport/plugin-api": "3.17.0",
34
- "@allurereport/plugin-awesome": "3.17.0",
35
- "@allurereport/plugin-classic": "3.17.0",
36
- "@allurereport/plugin-csv": "3.17.0",
37
- "@allurereport/plugin-dashboard": "3.17.0",
38
- "@allurereport/plugin-jira": "3.17.0",
39
- "@allurereport/plugin-log": "3.17.0",
40
- "@allurereport/plugin-progress": "3.17.0",
41
- "@allurereport/plugin-slack": "3.17.0",
42
- "@allurereport/plugin-testops": "3.17.0",
43
- "@allurereport/plugin-testplan": "3.17.0",
44
- "@allurereport/reader": "3.17.0",
45
- "@allurereport/reader-api": "3.17.0",
46
- "@allurereport/service": "3.17.0",
47
- "@allurereport/summary": "3.17.0",
28
+ "@allurereport/ci": "3.18.0",
29
+ "@allurereport/cli-commons": "3.18.0",
30
+ "@allurereport/core-api": "3.18.0",
31
+ "@allurereport/plugin-agent": "3.18.0",
32
+ "@allurereport/plugin-allure2": "3.18.0",
33
+ "@allurereport/plugin-api": "3.18.0",
34
+ "@allurereport/plugin-awesome": "3.18.0",
35
+ "@allurereport/plugin-classic": "3.18.0",
36
+ "@allurereport/plugin-csv": "3.18.0",
37
+ "@allurereport/plugin-dashboard": "3.18.0",
38
+ "@allurereport/plugin-jira": "3.18.0",
39
+ "@allurereport/plugin-log": "3.18.0",
40
+ "@allurereport/plugin-progress": "3.18.0",
41
+ "@allurereport/plugin-slack": "3.18.0",
42
+ "@allurereport/plugin-testops": "3.18.0",
43
+ "@allurereport/plugin-testplan": "3.18.0",
44
+ "@allurereport/reader": "3.18.0",
45
+ "@allurereport/reader-api": "3.18.0",
46
+ "@allurereport/service": "3.18.0",
47
+ "@allurereport/summary": "3.18.0",
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
53
  "yaml": "^2.8.3",
54
- "yoctocolors": "^2.1.2",
54
+ "yoctocolors": "^2.2.0",
55
55
  "zip-stream": "^7.0.5"
56
56
  },
57
57
  "devDependencies": {