@allurereport/web-commons 3.0.0-beta.15 → 3.0.0-beta.16
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/charts.d.ts
CHANGED
|
@@ -9,11 +9,14 @@ export declare enum ChartType {
|
|
|
9
9
|
Trend = "trend",
|
|
10
10
|
Pie = "pie"
|
|
11
11
|
}
|
|
12
|
-
export declare enum
|
|
12
|
+
export declare enum ChartDataType {
|
|
13
13
|
Status = "status",
|
|
14
14
|
Severity = "severity"
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export declare enum ChartMode {
|
|
17
|
+
Raw = "raw",
|
|
18
|
+
Percent = "percent"
|
|
19
|
+
}
|
|
17
20
|
export type ChartId = string;
|
|
18
21
|
export type ExecutionIdFn = (executionOrder: number) => string;
|
|
19
22
|
export type ExecutionNameFn = (executionOrder: number) => string;
|
|
@@ -23,7 +26,7 @@ export type TrendMetadataFnOverrides = {
|
|
|
23
26
|
};
|
|
24
27
|
export type TrendChartOptions = {
|
|
25
28
|
type: ChartType.Trend;
|
|
26
|
-
dataType:
|
|
29
|
+
dataType: ChartDataType;
|
|
27
30
|
mode?: ChartMode;
|
|
28
31
|
title?: string;
|
|
29
32
|
limit?: number;
|
|
@@ -48,7 +51,8 @@ export type TrendSlice<Metadata extends BaseMetadata> = {
|
|
|
48
51
|
};
|
|
49
52
|
export type GenericTrendChartData<Metadata extends BaseMetadata, SeriesType extends string> = {
|
|
50
53
|
type: ChartType.Trend;
|
|
51
|
-
dataType:
|
|
54
|
+
dataType: ChartDataType;
|
|
55
|
+
mode: ChartMode;
|
|
52
56
|
title?: string;
|
|
53
57
|
points: Record<TrendPointId, TrendPoint>;
|
|
54
58
|
slices: Record<TrendSliceId, TrendSlice<Metadata>>;
|
package/dist/charts.js
CHANGED
|
@@ -11,11 +11,16 @@ export var ChartType;
|
|
|
11
11
|
ChartType["Trend"] = "trend";
|
|
12
12
|
ChartType["Pie"] = "pie";
|
|
13
13
|
})(ChartType || (ChartType = {}));
|
|
14
|
-
export var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})(
|
|
14
|
+
export var ChartDataType;
|
|
15
|
+
(function (ChartDataType) {
|
|
16
|
+
ChartDataType["Status"] = "status";
|
|
17
|
+
ChartDataType["Severity"] = "severity";
|
|
18
|
+
})(ChartDataType || (ChartDataType = {}));
|
|
19
|
+
export var ChartMode;
|
|
20
|
+
(function (ChartMode) {
|
|
21
|
+
ChartMode["Raw"] = "raw";
|
|
22
|
+
ChartMode["Percent"] = "percent";
|
|
23
|
+
})(ChartMode || (ChartMode = {}));
|
|
19
24
|
export const createEmptyStats = (items) => items.reduce((acc, item) => ({ ...acc, [item]: 0 }), {});
|
|
20
25
|
export const createEmptySeries = (items) => items.reduce((acc, item) => ({ ...acc, [item]: [] }), {});
|
|
21
26
|
export const normalizeStatistic = (statistic, itemType) => {
|
|
@@ -51,7 +56,7 @@ const calculatePercentValues = (stats, executionId, itemType) => {
|
|
|
51
56
|
const value = stats[item] ?? 0;
|
|
52
57
|
points[pointId] = {
|
|
53
58
|
x: executionId,
|
|
54
|
-
y:
|
|
59
|
+
y: value / total,
|
|
55
60
|
};
|
|
56
61
|
series[item].push(pointId);
|
|
57
62
|
});
|
|
@@ -82,10 +87,10 @@ export const mergeTrendDataGeneric = (trendData, trendDataPart, itemType) => {
|
|
|
82
87
|
};
|
|
83
88
|
};
|
|
84
89
|
export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
|
|
85
|
-
const { type, dataType, title, mode =
|
|
90
|
+
const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
|
|
86
91
|
const { executionIdAccessor, executionNameAccessor } = metadata;
|
|
87
92
|
const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
|
|
88
|
-
const { points, series } = mode ===
|
|
93
|
+
const { points, series } = mode === ChartMode.Percent
|
|
89
94
|
? calculatePercentValues(stats, executionId, itemType)
|
|
90
95
|
: calculateRawValues(stats, executionId, itemType);
|
|
91
96
|
const slices = {};
|
|
@@ -108,6 +113,7 @@ export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType,
|
|
|
108
113
|
return {
|
|
109
114
|
type,
|
|
110
115
|
dataType,
|
|
116
|
+
mode,
|
|
111
117
|
title,
|
|
112
118
|
points,
|
|
113
119
|
slices,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-commons",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "Collection of utilities used across the web Allure reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf ./dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
26
|
+
"@allurereport/core-api": "3.0.0-beta.16"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@stylistic/eslint-plugin": "^2.6.1",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/eslint": "^8.56.11",
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
33
33
|
"@typescript-eslint/parser": "^8.0.0",
|
|
34
|
-
"@vitest/runner": "^2.1.
|
|
34
|
+
"@vitest/runner": "^2.1.9",
|
|
35
35
|
"allure-js-commons": "^3.0.9",
|
|
36
36
|
"allure-vitest": "^3.0.9",
|
|
37
37
|
"d3-shape": "^3.2.0",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"rimraf": "^6.0.1",
|
|
46
46
|
"tslib": "^2.7.0",
|
|
47
47
|
"typescript": "^5.6.3",
|
|
48
|
-
"vitest": "^2.1.
|
|
48
|
+
"vitest": "^2.1.9"
|
|
49
49
|
}
|
|
50
50
|
}
|