@allurereport/plugin-classic 3.0.0-beta.17 → 3.0.0-beta.19
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/generators.js +2 -4
- package/package.json +6 -7
- package/dist/charts.d.ts +0 -14
- package/dist/charts.js +0 -26
package/dist/generators.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { compareBy, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
1
|
+
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, getPieChartValues, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
2
2
|
import { createTreeByCategories, createTreeByLabels, filterTree, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
3
|
-
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
|
|
4
3
|
import Handlebars from "handlebars";
|
|
5
4
|
import { readFile } from "node:fs/promises";
|
|
6
5
|
import { createRequire } from "node:module";
|
|
7
6
|
import { basename, join } from "node:path";
|
|
8
7
|
import { matchCategories } from "./categories.js";
|
|
9
|
-
import { getChartData } from "./charts.js";
|
|
10
8
|
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
11
9
|
const require = createRequire(import.meta.url);
|
|
12
10
|
const template = `<!DOCTYPE html>
|
|
@@ -141,7 +139,7 @@ export const generateStatistic = async (writer, statistic) => {
|
|
|
141
139
|
await writer.writeWidget("allure_statistic.json", statistic);
|
|
142
140
|
};
|
|
143
141
|
export const generatePieChart = async (writer, statistic) => {
|
|
144
|
-
const chartData =
|
|
142
|
+
const chartData = getPieChartValues(statistic);
|
|
145
143
|
await writer.writeWidget("allure_pie_chart.json", chartData);
|
|
146
144
|
};
|
|
147
145
|
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.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
4
4
|
"description": "The classic version of Allure HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
35
|
-
"@allurereport/web-awesome": "3.0.0-beta.
|
|
36
|
-
"@allurereport/web-classic": "3.0.0-beta.
|
|
37
|
-
"@allurereport/web-commons": "3.0.0-beta.17",
|
|
33
|
+
"@allurereport/core-api": "3.0.0-beta.19",
|
|
34
|
+
"@allurereport/plugin-api": "3.0.0-beta.19",
|
|
35
|
+
"@allurereport/web-awesome": "3.0.0-beta.19",
|
|
36
|
+
"@allurereport/web-classic": "3.0.0-beta.19",
|
|
38
37
|
"d3-shape": "^3.2.0",
|
|
39
38
|
"handlebars": "^4.7.8"
|
|
40
39
|
},
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
47
46
|
"@typescript-eslint/parser": "^8.0.0",
|
|
48
47
|
"@vitest/runner": "^2.1.9",
|
|
49
|
-
"allure-vitest": "^3.3.
|
|
48
|
+
"allure-vitest": "^3.3.3",
|
|
50
49
|
"eslint": "^8.57.0",
|
|
51
50
|
"eslint-config-prettier": "^9.1.0",
|
|
52
51
|
"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
|
-
};
|