@allurereport/plugin-classic 3.0.0-beta.17 → 3.0.0-beta.18

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,4 +1,4 @@
1
- import { compareBy, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
1
+ import { compareBy, getPieChartValues, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
2
2
  import { createTreeByCategories, createTreeByLabels, filterTree, sortTree, transformTree, } from "@allurereport/plugin-api";
3
3
  import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
4
4
  import Handlebars from "handlebars";
@@ -6,7 +6,6 @@ import { readFile } from "node:fs/promises";
6
6
  import { createRequire } from "node:module";
7
7
  import { basename, join } from "node:path";
8
8
  import { matchCategories } from "./categories.js";
9
- import { getChartData } from "./charts.js";
10
9
  import { convertFixtureResult, convertTestResult } from "./converters.js";
11
10
  const require = createRequire(import.meta.url);
12
11
  const template = `<!DOCTYPE html>
@@ -141,7 +140,7 @@ export const generateStatistic = async (writer, statistic) => {
141
140
  await writer.writeWidget("allure_statistic.json", statistic);
142
141
  };
143
142
  export const generatePieChart = async (writer, statistic) => {
144
- const chartData = getChartData(statistic);
143
+ const chartData = getPieChartValues(statistic);
145
144
  await writer.writeWidget("allure_pie_chart.json", chartData);
146
145
  };
147
146
  export const generateAttachmentsFiles = async (writer, attachmentLinks, contentFunction) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-classic",
3
- "version": "3.0.0-beta.17",
3
+ "version": "3.0.0-beta.18",
4
4
  "description": "The classic version of Allure HTML report",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,11 +30,11 @@
30
30
  "test": "rimraf ./out && vitest run"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/core-api": "3.0.0-beta.17",
34
- "@allurereport/plugin-api": "3.0.0-beta.17",
35
- "@allurereport/web-awesome": "3.0.0-beta.17",
36
- "@allurereport/web-classic": "3.0.0-beta.17",
37
- "@allurereport/web-commons": "3.0.0-beta.17",
33
+ "@allurereport/core-api": "3.0.0-beta.18",
34
+ "@allurereport/plugin-api": "3.0.0-beta.18",
35
+ "@allurereport/web-awesome": "3.0.0-beta.18",
36
+ "@allurereport/web-classic": "3.0.0-beta.18",
37
+ "@allurereport/web-commons": "3.0.0-beta.18",
38
38
  "d3-shape": "^3.2.0",
39
39
  "handlebars": "^4.7.8"
40
40
  },
@@ -46,7 +46,7 @@
46
46
  "@typescript-eslint/eslint-plugin": "^8.0.0",
47
47
  "@typescript-eslint/parser": "^8.0.0",
48
48
  "@vitest/runner": "^2.1.9",
49
- "allure-vitest": "^3.3.0",
49
+ "allure-vitest": "^3.3.3",
50
50
  "eslint": "^8.57.0",
51
51
  "eslint-config-prettier": "^9.1.0",
52
52
  "eslint-plugin-import": "^2.29.1",
package/dist/charts.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { Statistic, TestStatus } from "@allurereport/core-api";
2
- import type { PieArcDatum } from "d3-shape";
3
- export type TestResultSlice = {
4
- status: TestStatus;
5
- count: number;
6
- };
7
- export type TestResultChartData = {
8
- percentage: number;
9
- slices: TestResultSlice[];
10
- };
11
- export declare const d3Arc: import("d3-shape").Arc<any, PieArcDatum<TestResultSlice>>;
12
- export declare const d3Pie: import("d3-shape").Pie<any, TestResultSlice>;
13
- export declare const getPercentage: (value: number, total: number) => number;
14
- export declare const getChartData: (stats: Statistic) => TestResultChartData;
package/dist/charts.js DELETED
@@ -1,26 +0,0 @@
1
- import { statusesList } from "@allurereport/core-api";
2
- import { arc, pie } from "d3-shape";
3
- export const d3Arc = arc().innerRadius(40).outerRadius(50).cornerRadius(2).padAngle(0.03);
4
- export const d3Pie = pie()
5
- .value((d) => d.count)
6
- .padAngle(0.03)
7
- .sortValues((a, b) => a - b);
8
- export const getPercentage = (value, total) => Math.floor((value / total) * 10000) / 100;
9
- export const getChartData = (stats) => {
10
- const convertedStatuses = statusesList
11
- .filter((status) => !!stats?.[status])
12
- .map((status) => ({
13
- status,
14
- count: stats[status],
15
- }));
16
- const arcsData = d3Pie(convertedStatuses);
17
- const slices = arcsData.map((arcData) => ({
18
- d: d3Arc(arcData),
19
- ...arcData.data,
20
- }));
21
- const percentage = getPercentage(stats.passed ?? 0, stats.total);
22
- return {
23
- slices,
24
- percentage,
25
- };
26
- };