@allurereport/plugin-awesome 3.4.1 → 3.5.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.
@@ -1,5 +1,5 @@
1
- import { type AttachmentLink, type EnvironmentIdentity, type EnvironmentItem, type Statistic, type TestEnvGroup, type TestError, type TestResult } from "@allurereport/core-api";
2
- import type { AllureStore, ExitCode, PluginContext, QualityGateValidationResult, ReportFiles, ResultFile } from "@allurereport/plugin-api";
1
+ import { type AttachmentLink, type EnvironmentIdentity, type EnvironmentItem, type Statistic, type TestEnvGroup, type TestResult } from "@allurereport/core-api";
2
+ import type { AllureStore, ExitCode, PluginContext, PluginGlobalAttachment, PluginGlobalError, QualityGateValidationResult, ReportFiles, ResultFile } from "@allurereport/plugin-api";
3
3
  import type { AwesomeTestResult } from "@allurereport/web-awesome";
4
4
  import type { AwesomeOptions, TemplateManifest } from "./model.js";
5
5
  import type { AwesomeDataWriter, ReportFile } from "./writer.js";
@@ -25,8 +25,10 @@ export declare const generateAttachmentsFiles: (writer: AwesomeDataWriter, attac
25
25
  export declare const generateHistoryDataPoints: (writer: AwesomeDataWriter, store: AllureStore) => Promise<Map<string, string>>;
26
26
  export declare const generateGlobals: (writer: AwesomeDataWriter, payload: {
27
27
  globalExitCode?: ExitCode;
28
- globalAttachments?: AttachmentLink[];
29
- globalErrors?: TestError[];
28
+ globalAttachments?: PluginGlobalAttachment[];
29
+ globalAttachmentsByEnv?: Record<string, PluginGlobalAttachment[]>;
30
+ globalErrors?: PluginGlobalError[];
31
+ globalErrorsByEnv?: Record<string, PluginGlobalError[]>;
30
32
  contentFunction: (id: string) => Promise<ResultFile | undefined>;
31
33
  }) => Promise<void>;
32
34
  export declare const generateQualityGateResults: (writer: AwesomeDataWriter, qualityGateResults?: Record<string, QualityGateValidationResult[]>) => Promise<void>;
@@ -266,11 +266,12 @@ export const generateHistoryDataPoints = async (writer, store) => {
266
266
  return result;
267
267
  };
268
268
  export const generateGlobals = async (writer, payload) => {
269
- const { globalExitCode, globalAttachments = [], globalErrors = [], contentFunction } = payload;
269
+ const { globalExitCode, globalAttachments = [], globalAttachmentsByEnv = {}, globalErrors = [], globalErrorsByEnv = {}, contentFunction, } = payload;
270
270
  const globals = {
271
271
  errors: globalErrors,
272
272
  attachments: [],
273
273
  };
274
+ const attachmentsByEnv = {};
274
275
  if (globalExitCode) {
275
276
  globals.exitCode = globalExitCode;
276
277
  }
@@ -283,6 +284,20 @@ export const generateGlobals = async (writer, payload) => {
283
284
  await writer.writeAttachment(src, content);
284
285
  globals.attachments.push(attachment);
285
286
  }
287
+ Object.entries(globalAttachmentsByEnv).forEach(([environmentId, attachments]) => {
288
+ const attachmentIds = new Set(globals.attachments.map(({ id }) => id));
289
+ const writtenAttachments = attachments.filter(({ id }) => attachmentIds.has(id));
290
+ if (writtenAttachments.length === 0) {
291
+ return;
292
+ }
293
+ attachmentsByEnv[environmentId] = writtenAttachments;
294
+ });
295
+ if (Object.keys(attachmentsByEnv).length > 0) {
296
+ globals.attachmentsByEnv = attachmentsByEnv;
297
+ }
298
+ if (Object.keys(globalErrorsByEnv).length > 0) {
299
+ globals.errorsByEnv = globalErrorsByEnv;
300
+ }
286
301
  await writer.writeWidget("globals.json", globals);
287
302
  };
288
303
  export const generateQualityGateResults = async (writer, qualityGateResults = {}) => {
package/dist/plugin.js CHANGED
@@ -53,8 +53,10 @@ export class AwesomePlugin {
53
53
  const envStatistics = new Map();
54
54
  const allTestEnvGroups = await store.allTestEnvGroups();
55
55
  const globalAttachments = await store.allGlobalAttachments();
56
+ const globalAttachmentsByEnv = await store.allGlobalAttachmentsByEnv();
56
57
  const globalExitCode = await store.globalExitCode();
57
58
  const globalErrors = await store.allGlobalErrors();
59
+ const globalErrorsByEnv = await store.allGlobalErrorsByEnv();
58
60
  const qualityGateResults = await store.qualityGateResultsByEnvironmentId();
59
61
  const envResultsById = new Map();
60
62
  const envIdByTrId = new Map();
@@ -139,7 +141,9 @@ export class AwesomePlugin {
139
141
  await generateQualityGateResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), qualityGateResults);
140
142
  await generateGlobals(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
141
143
  globalAttachments,
144
+ globalAttachmentsByEnv,
142
145
  globalErrors,
146
+ globalErrorsByEnv,
143
147
  globalExitCode,
144
148
  contentFunction: (id) => store.attachmentContentById(id),
145
149
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-awesome",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,11 +30,11 @@
30
30
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/charts-api": "3.4.1",
34
- "@allurereport/core-api": "3.4.1",
35
- "@allurereport/plugin-api": "3.4.1",
36
- "@allurereport/web-awesome": "3.4.1",
37
- "@allurereport/web-commons": "3.4.1",
33
+ "@allurereport/charts-api": "3.5.0",
34
+ "@allurereport/core-api": "3.5.0",
35
+ "@allurereport/plugin-api": "3.5.0",
36
+ "@allurereport/web-awesome": "3.5.0",
37
+ "@allurereport/web-commons": "3.5.0",
38
38
  "d3-shape": "^3.2.0",
39
39
  "handlebars": "^4.7.9",
40
40
  "markdown-it": "^14.1.0"