@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.
@@ -35,6 +35,7 @@ export const getSeverityTrendData = (testResults, reportName, historyPoints, cha
35
35
  }, {
36
36
  type: chartOptions.type,
37
37
  dataType: chartOptions.dataType,
38
+ mode: chartOptions.mode,
38
39
  title: chartOptions.title,
39
40
  points: {},
40
41
  slices: {},
@@ -26,6 +26,7 @@ export const getStatusTrendData = (currentStatistic, reportName, historyPoints,
26
26
  }, {
27
27
  type: chartOptions.type,
28
28
  dataType: chartOptions.dataType,
29
+ mode: chartOptions.mode,
29
30
  title: chartOptions.title,
30
31
  points: {},
31
32
  slices: {},
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 ChartData {
12
+ export declare enum ChartDataType {
13
13
  Status = "status",
14
14
  Severity = "severity"
15
15
  }
16
- export type ChartMode = "raw" | "percent";
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: ChartData;
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: ChartData;
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 ChartData;
15
- (function (ChartData) {
16
- ChartData["Status"] = "status";
17
- ChartData["Severity"] = "severity";
18
- })(ChartData || (ChartData = {}));
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: (value / total) * 100,
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 = "raw", metadata = {} } = chartOptions;
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 === "percent"
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.15",
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.15"
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.8",
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.8"
48
+ "vitest": "^2.1.9"
49
49
  }
50
50
  }