@allurereport/plugin-awesome 3.19.0 → 3.19.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/plugin.js CHANGED
@@ -65,52 +65,86 @@ export class AwesomePlugin {
65
65
  });
66
66
  _AwesomePlugin_generate.set(this, async (context, store) => {
67
67
  const { singleFile, groupBy = [], filter, appendTitlePath } = this.options ?? {};
68
+ const perf = context.perf;
69
+ const measure = (name, fn) => perf?.measure(name, fn) ?? fn();
68
70
  const hideLabels = context.hideLabels;
69
71
  const categories = context.categories ?? [];
70
- const environmentItems = await store.metadataByKey("allure_environment");
71
- const executor = await store.metadataByKey("allure2_executor");
72
- const attachments = await store.allAttachments();
73
- const allTrs = await store.allTestResults({ includeRetries: true, filter });
74
- const runSummary = getRunSummary(allTrs);
75
- const statistics = await store.testsStatistic(filter);
76
- const environments = await store.allEnvironmentIdentities();
77
- const envStatistics = new Map();
78
- const pieStatistics = await statisticByTestResults(store, allTrs.filter(isActiveStatisticTestResult));
79
- const pieEnvStatistics = new Map();
80
- const allTestEnvGroups = await store.allTestEnvGroups();
81
- const globalAttachments = await store.allGlobalAttachments();
82
- const globalAttachmentsByEnv = await store.allGlobalAttachmentsByEnv();
83
- const globalExitCode = await store.globalExitCode();
84
- const globalErrors = await store.allGlobalErrors();
85
- const globalErrorsByEnv = await store.allGlobalErrorsByEnv();
86
- const qualityGateResults = await store.qualityGateResultsByEnvironmentId();
72
+ const { environmentItems, executor, attachments, allTrs, runSummary, statistics, environments, allTestEnvGroups, globalAttachments, globalAttachmentsByEnv, globalExitCode, globalErrors, globalErrorsByEnv, qualityGateResults, } = await measure("readData", async () => {
73
+ const testResults = await store.allTestResults({ includeRetries: true, filter });
74
+ return {
75
+ environmentItems: await store.metadataByKey("allure_environment"),
76
+ executor: await store.metadataByKey("allure2_executor"),
77
+ attachments: await store.allAttachments(),
78
+ allTrs: testResults,
79
+ runSummary: getRunSummary(testResults),
80
+ statistics: await store.testsStatistic(filter),
81
+ environments: await store.allEnvironmentIdentities(),
82
+ allTestEnvGroups: await store.allTestEnvGroups(),
83
+ globalAttachments: await store.allGlobalAttachments(),
84
+ globalAttachmentsByEnv: await store.allGlobalAttachmentsByEnv(),
85
+ globalExitCode: await store.globalExitCode(),
86
+ globalErrors: await store.allGlobalErrors(),
87
+ globalErrorsByEnv: await store.allGlobalErrorsByEnv(),
88
+ qualityGateResults: await store.qualityGateResultsByEnvironmentId(),
89
+ };
90
+ });
91
+ if (perf && attachments.length > 0) {
92
+ perf.count("attachments.count", attachments.length, {
93
+ title: "Attachments",
94
+ unit: "attachments",
95
+ group: "workload",
96
+ groupTitle: "Workload",
97
+ better: "neutral",
98
+ });
99
+ perf.count("attachmentBytes", attachments.reduce((total, attachment) => total + ("contentLength" in attachment ? (attachment.contentLength ?? 0) : 0), 0), {
100
+ title: "Attachment bytes",
101
+ unit: "bytes",
102
+ group: "workload",
103
+ groupTitle: "Workload",
104
+ better: "neutral",
105
+ });
106
+ }
87
107
  const envIdByTrId = new Map();
88
- await Promise.all(allTrs.map(async (tr) => {
89
- const environmentId = await store.environmentIdByTrId(tr.id);
90
- if (!environmentId) {
91
- return;
92
- }
93
- envIdByTrId.set(tr.id, environmentId);
94
- }));
108
+ await measure("environmentMap", async () => {
109
+ await Promise.all(allTrs.map(async (tr) => {
110
+ const environmentId = await store.environmentIdByTrId(tr.id);
111
+ if (!environmentId) {
112
+ return;
113
+ }
114
+ envIdByTrId.set(tr.id, environmentId);
115
+ }));
116
+ });
95
117
  const trsByEnvId = new Map();
96
- for (const tr of allTrs) {
97
- const environmentId = envIdByTrId.get(tr.id);
98
- if (!environmentId) {
99
- continue;
100
- }
101
- const group = trsByEnvId.get(environmentId);
102
- if (group) {
103
- group.push(tr);
104
- }
105
- else {
106
- trsByEnvId.set(environmentId, [tr]);
118
+ await measure("stats", async () => {
119
+ const envStatistics = new Map();
120
+ const pieStatistics = await statisticByTestResults(store, allTrs.filter(isActiveStatisticTestResult));
121
+ const pieEnvStatistics = new Map();
122
+ for (const tr of allTrs) {
123
+ const environmentId = envIdByTrId.get(tr.id);
124
+ if (!environmentId) {
125
+ continue;
126
+ }
127
+ const group = trsByEnvId.get(environmentId);
128
+ if (group) {
129
+ group.push(tr);
130
+ }
131
+ else {
132
+ trsByEnvId.set(environmentId, [tr]);
133
+ }
107
134
  }
108
- }
109
- await Promise.all(environments.map(async ({ id }) => {
110
- const envTrs = trsByEnvId.get(id) ?? [];
111
- envStatistics.set(id, await statisticByTestResults(store, envTrs));
112
- pieEnvStatistics.set(id, await statisticByTestResults(store, envTrs.filter(isActiveStatisticTestResult)));
113
- }));
135
+ await Promise.all(environments.map(async ({ id }) => {
136
+ const envTrs = trsByEnvId.get(id) ?? [];
137
+ envStatistics.set(id, await statisticByTestResults(store, envTrs));
138
+ pieEnvStatistics.set(id, await statisticByTestResults(store, envTrs.filter(isActiveStatisticTestResult)));
139
+ }));
140
+ await generateStatistic(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
141
+ stats: statistics,
142
+ statsByEnv: envStatistics,
143
+ pieStats: pieStatistics,
144
+ pieStatsByEnv: pieEnvStatistics,
145
+ envs: environments,
146
+ });
147
+ });
114
148
  const runSummaryByEnv = {};
115
149
  for (const { id } of environments) {
116
150
  const envRunSummary = getRunSummary(trsByEnvId.get(id) ?? []);
@@ -118,88 +152,98 @@ export class AwesomePlugin {
118
152
  runSummaryByEnv[id] = envRunSummary;
119
153
  }
120
154
  }
121
- await generateStatistic(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
122
- stats: statistics,
123
- statsByEnv: envStatistics,
124
- pieStats: pieStatistics,
125
- pieStatsByEnv: pieEnvStatistics,
126
- envs: environments,
127
- });
128
- await generateAllCharts(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options, context);
155
+ await measure("charts", () => generateAllCharts(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options, context));
129
156
  const hasMetrics = await generateMetricsWidget(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, context.reportUuid);
130
- const convertedTrs = await generateTestResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, allTrs, {
157
+ const convertedTrs = await measure("convert", () => generateTestResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, allTrs, {
131
158
  pluginId: context.id,
132
159
  hideLabels,
133
160
  resolveHistoryUrl: context.history?.resolveTestResultUrl,
161
+ }));
162
+ if (perf) {
163
+ perf.count("convertedTestResults.count", convertedTrs.length, {
164
+ title: "Converted test results",
165
+ unit: "test results",
166
+ group: "workload",
167
+ groupTitle: "Workload",
168
+ better: "neutral",
169
+ });
170
+ }
171
+ await measure("categories", async () => {
172
+ applyCategoriesToTestResults(convertedTrs, categories);
173
+ await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
174
+ tests: convertedTrs,
175
+ categories,
176
+ environmentCount: environments.length,
177
+ environments: environments.map(({ id }) => id),
178
+ defaultEnvironment: "default",
179
+ selectedEnvironmentCount: environments.length,
180
+ });
181
+ await generateResolutionCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
134
182
  });
135
- applyCategoriesToTestResults(convertedTrs, categories);
136
- await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
137
- tests: convertedTrs,
138
- categories,
139
- environmentCount: environments.length,
140
- environments: environments.map(({ id }) => id),
141
- defaultEnvironment: "default",
142
- selectedEnvironmentCount: environments.length,
143
- });
144
- await generateResolutionCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
145
183
  const hasGroupBy = groupBy.length > 0;
146
- await generateTimeline(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTrs, this.options, envIdByTrId, new Map(environments.map(({ id, name }) => [id, name])));
184
+ await measure("timeline", () => generateTimeline(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTrs, this.options, envIdByTrId, new Map(environments.map(({ id, name }) => [id, name]))));
147
185
  const treeLabels = hasGroupBy
148
186
  ? preciseTreeLabels(groupBy, convertedTrs, ({ labels }) => labels.map(({ name }) => name))
149
187
  : [];
150
188
  await generateHistoryDataPoints(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store);
151
- await generateTestCases(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
152
- await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), "tree.json", treeLabels, convertedTrs, { appendTitlePath });
153
- await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs, "nav.json");
154
- await generateSearchIndex(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs, "search-index.json");
155
- await generateTestEnvGroups(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTestEnvGroups);
189
+ await measure("testCases", () => generateTestCases(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs));
190
+ await measure("tree", () => generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), "tree.json", treeLabels, convertedTrs, { appendTitlePath }));
191
+ await measure("nav", () => generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs, "nav.json"));
192
+ await measure("searchIndex", () => generateSearchIndex(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs, "search-index.json"));
193
+ await measure("testEnvGroups", () => generateTestEnvGroups(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTestEnvGroups));
156
194
  const convertedTrsById = new Map(convertedTrs.map((tr) => [tr.id, tr]));
157
- for (const reportEnvironment of environments) {
158
- const envTrs = await store.testResultsByEnvironmentId(reportEnvironment.id, { includeRetries: true });
159
- const envConvertedTrs = envTrs
160
- .map((tr) => convertedTrsById.get(tr.id))
161
- .filter((tr) => Boolean(tr));
162
- await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), joinPosixPath(reportEnvironment.id, "tree.json"), treeLabels, envConvertedTrs, {
163
- appendTitlePath,
164
- });
165
- await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "nav.json"));
166
- await generateSearchIndex(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "search-index.json"));
167
- await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
168
- tests: envConvertedTrs,
169
- categories,
170
- environmentCount: 1,
171
- defaultEnvironment: "default",
172
- selectedEnvironmentCount: 1,
173
- filename: joinPosixPath(reportEnvironment.id, "categories.json"),
174
- });
175
- await generateResolutionCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "resolution-categories.json"));
176
- }
195
+ await measure("environmentsOutput", async () => {
196
+ for (const reportEnvironment of environments) {
197
+ const envTrs = await store.testResultsByEnvironmentId(reportEnvironment.id, { includeRetries: true });
198
+ const envConvertedTrs = envTrs
199
+ .map((tr) => convertedTrsById.get(tr.id))
200
+ .filter((tr) => Boolean(tr));
201
+ await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), joinPosixPath(reportEnvironment.id, "tree.json"), treeLabels, envConvertedTrs, {
202
+ appendTitlePath,
203
+ });
204
+ await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "nav.json"));
205
+ await generateSearchIndex(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "search-index.json"));
206
+ await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
207
+ tests: envConvertedTrs,
208
+ categories,
209
+ environmentCount: 1,
210
+ defaultEnvironment: "default",
211
+ selectedEnvironmentCount: 1,
212
+ filename: joinPosixPath(reportEnvironment.id, "categories.json"),
213
+ });
214
+ await generateResolutionCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "resolution-categories.json"));
215
+ }
216
+ });
177
217
  await generateTreeFilters(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
178
218
  await generateEnvirontmentsList(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store);
179
219
  await generateVariables(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store);
180
220
  await generateEnvironmentJson(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), environmentItems ?? []);
181
221
  if (attachments?.length) {
182
- await generateAttachmentsFiles(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), attachments, (id) => store.attachmentContentById(id));
222
+ await measure("attachments", () => generateAttachmentsFiles(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), attachments, (id) => store.attachmentContentById(id)));
183
223
  }
184
224
  await generateQualityGateResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), qualityGateResults, {
185
225
  tests: convertedTrs,
186
226
  labels: treeLabels,
187
227
  appendTitlePath,
188
228
  });
189
- await generateGlobals(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
229
+ await measure("globals", () => generateGlobals(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
190
230
  globalAttachments,
191
231
  globalAttachmentsByEnv,
192
232
  globalErrors,
193
233
  globalErrorsByEnv,
194
234
  globalExitCode,
195
235
  contentFunction: (id) => store.attachmentContentById(id),
196
- });
197
- const reportDataFiles = singleFile ? __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles() : [];
236
+ }));
237
+ const reportDataFiles = !singleFile
238
+ ? []
239
+ : perf
240
+ ? await perf.measure("singleFileReportFiles", async () => __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles())
241
+ : __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles();
198
242
  const configuredSections = this.options.sections ?? ["charts", "timeline"];
199
243
  const sections = hasMetrics
200
244
  ? [...new Set([...configuredSections, "metrics"])]
201
245
  : configuredSections.filter((section) => section !== "metrics");
202
- await generateStaticFiles({
246
+ await measure("staticFiles", () => generateStaticFiles({
203
247
  ...this.options,
204
248
  sections,
205
249
  id: context.id,
@@ -212,7 +256,7 @@ export class AwesomePlugin {
212
256
  runSummary,
213
257
  runSummaryByEnv,
214
258
  reportDataFiles,
215
- });
259
+ }));
216
260
  });
217
261
  this.start = async (context) => {
218
262
  const { singleFile } = this.options;
@@ -231,7 +275,8 @@ export class AwesomePlugin {
231
275
  };
232
276
  }
233
277
  async info(context, store) {
234
- return createPluginSummary({
278
+ const perf = context.perf;
279
+ const create = () => createPluginSummary({
235
280
  name: this.options.reportName || context.reportName,
236
281
  plugin: "Awesome",
237
282
  meta: {
@@ -244,6 +289,7 @@ export class AwesomePlugin {
244
289
  history: context.history,
245
290
  store,
246
291
  });
292
+ return perf?.measure("summary.create", create) ?? create();
247
293
  }
248
294
  }
249
295
  _AwesomePlugin_writer = new WeakMap(), _AwesomePlugin_generateAfterStart = new WeakMap(), _AwesomePlugin_generate = new WeakMap();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-awesome",
3
- "version": "3.19.0",
3
+ "version": "3.19.1",
4
4
  "description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,16 +30,16 @@
30
30
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/charts-api": "3.19.0",
34
- "@allurereport/core-api": "3.19.0",
35
- "@allurereport/plugin-api": "3.19.0",
36
- "@allurereport/web-commons": "3.19.0",
33
+ "@allurereport/charts-api": "3.19.1",
34
+ "@allurereport/core-api": "3.19.1",
35
+ "@allurereport/plugin-api": "3.19.1",
36
+ "@allurereport/web-commons": "3.19.1",
37
37
  "d3-shape": "^3.2.0",
38
38
  "handlebars": "^4.7.9",
39
39
  "markdown-it": "^14.2.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@allurereport/web-awesome": "3.19.0",
42
+ "@allurereport/web-awesome": "3.19.1",
43
43
  "@types/d3-shape": "^3.1.8",
44
44
  "@types/markdown-it": "^14.1.2",
45
45
  "@types/node": "^20",