@allurereport/plugin-awesome 3.0.0-beta.11 → 3.0.0-beta.13

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.
@@ -0,0 +1,3 @@
1
+ import type { TestResult } from "@allurereport/core-api";
2
+ import type { TestResultFilter } from "@allurereport/plugin-api";
3
+ export declare const filterEnv: (env: string, filter?: TestResultFilter) => (testResult: TestResult) => boolean;
@@ -0,0 +1,8 @@
1
+ export const filterEnv = (env, filter) => {
2
+ return (testResult) => {
3
+ if (testResult.environment !== env) {
4
+ return false;
5
+ }
6
+ return filter ? filter(testResult) : true;
7
+ };
8
+ };
@@ -8,6 +8,7 @@ import { createRequire } from "node:module";
8
8
  import { basename, join } from "node:path";
9
9
  import { getPieChartData } from "./charts.js";
10
10
  import { convertFixtureResult, convertTestResult } from "./converters.js";
11
+ import { filterEnv } from "./environments.js";
11
12
  const require = createRequire(import.meta.url);
12
13
  const template = `<!DOCTYPE html>
13
14
  <html dir="ltr" lang="en">
@@ -119,9 +120,11 @@ export const generateNav = async (writer, trs, filename = "nav.json") => {
119
120
  export const generateTree = async (writer, treeFilename, labels, tests) => {
120
121
  const visibleTests = tests.filter((test) => !test.hidden);
121
122
  const tree = createTreeByLabels(visibleTests, labels, ({ id, name, status, duration, flaky, start, retries }) => {
123
+ const retriesCount = retries?.length;
122
124
  return {
123
125
  nodeId: id,
124
- retry: !!retries?.length,
126
+ retry: Boolean(retriesCount),
127
+ retriesCount,
125
128
  name,
126
129
  status,
127
130
  duration,
@@ -153,16 +156,11 @@ export const generateVariables = async (writer, store) => {
153
156
  }
154
157
  };
155
158
  export const generateStatistic = async (writer, store, filter) => {
156
- const reportStatistic = await store.testsStatistic(filter);
159
+ const statistic = await store.testsStatistic(filter);
157
160
  const environments = await store.allEnvironments();
158
- await writer.writeWidget("statistic.json", reportStatistic);
161
+ await writer.writeWidget("statistic.json", statistic);
159
162
  for (const env of environments) {
160
- const envStatistic = await store.testsStatistic((testResult) => {
161
- if (testResult.environment !== env) {
162
- return false;
163
- }
164
- return filter ? filter(testResult) : true;
165
- });
163
+ const envStatistic = await store.testsStatistic(filterEnv(env, filter));
166
164
  await writer.writeWidget(join(env, "statistic.json"), envStatistic);
167
165
  }
168
166
  };
@@ -171,12 +169,7 @@ export const generatePieChart = async (writer, store, filter) => {
171
169
  const environments = await store.allEnvironments();
172
170
  await writer.writeWidget("pie_chart.json", getPieChartData(reportStatistic));
173
171
  for (const env of environments) {
174
- const envStatistic = await store.testsStatistic((testResult) => {
175
- if (testResult.environment !== env) {
176
- return false;
177
- }
178
- return filter ? filter(testResult) : true;
179
- });
172
+ const envStatistic = await store.testsStatistic(filterEnv(env, filter));
180
173
  await writer.writeWidget(join(env, "pie_chart.json"), getPieChartData(envStatistic));
181
174
  }
182
175
  };
package/dist/writer.js CHANGED
@@ -5,7 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _InMemoryReportDataWriter_data;
7
7
  import { mkdir, writeFile } from "node:fs/promises";
8
- import { join, resolve } from "node:path";
8
+ import { resolve } from "node:path";
9
9
  import { join as joinPosix } from "node:path/posix";
10
10
  export class FileSystemReportDataWriter {
11
11
  constructor(output) {
@@ -78,7 +78,7 @@ export class ReportFileDataWriter {
78
78
  if (!contentBuffer) {
79
79
  return;
80
80
  }
81
- await this.reportFiles.addFile(join("data", "attachments", source), contentBuffer);
81
+ await this.reportFiles.addFile(joinPosix("data", "attachments", source), contentBuffer);
82
82
  }
83
83
  async writeTestCase(test) {
84
84
  await this.reportFiles.addFile(joinPosix("data", "test-results", `${test.id}.json`), Buffer.from(JSON.stringify(test), "utf8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-awesome",
3
- "version": "3.0.0-beta.11",
3
+ "version": "3.0.0-beta.13",
4
4
  "description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,10 +30,10 @@
30
30
  "test": "rimraf ./out && vitest run"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/core-api": "3.0.0-beta.11",
34
- "@allurereport/plugin-api": "3.0.0-beta.11",
35
- "@allurereport/web-awesome": "3.0.0-beta.11",
36
- "@allurereport/web-commons": "3.0.0-beta.11",
33
+ "@allurereport/core-api": "3.0.0-beta.13",
34
+ "@allurereport/plugin-api": "3.0.0-beta.13",
35
+ "@allurereport/web-awesome": "3.0.0-beta.13",
36
+ "@allurereport/web-commons": "3.0.0-beta.13",
37
37
  "d3-shape": "^3.2.0",
38
38
  "handlebars": "^4.7.8"
39
39
  },