@allurereport/core-api 3.0.0-beta.16 → 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.
- package/dist/charts/types.d.ts +46 -0
- package/dist/charts/types.js +19 -0
- package/dist/charts/utils.d.ts +6 -0
- package/dist/charts/utils.js +34 -0
- package/dist/ci.d.ts +23 -0
- package/dist/ci.js +11 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/model.d.ts +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TestStatus } from "../model.js";
|
|
2
|
+
export declare enum ChartType {
|
|
3
|
+
Trend = "trend",
|
|
4
|
+
Pie = "pie",
|
|
5
|
+
TreeMap = "treemap",
|
|
6
|
+
HeatMap = "heatmap",
|
|
7
|
+
Bar = "bar",
|
|
8
|
+
Funnel = "funnel"
|
|
9
|
+
}
|
|
10
|
+
export declare enum ChartDataType {
|
|
11
|
+
Status = "status",
|
|
12
|
+
Severity = "severity"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ChartMode {
|
|
15
|
+
Raw = "raw",
|
|
16
|
+
Percent = "percent"
|
|
17
|
+
}
|
|
18
|
+
export type ChartId = string;
|
|
19
|
+
export type TrendPointId = string;
|
|
20
|
+
export type TrendSliceId = string;
|
|
21
|
+
export type BaseMetadata = Record<string, unknown>;
|
|
22
|
+
export interface BaseTrendSliceMetadata extends BaseMetadata {
|
|
23
|
+
executionId: string;
|
|
24
|
+
executionName?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TrendPoint {
|
|
27
|
+
x: string;
|
|
28
|
+
y: number;
|
|
29
|
+
}
|
|
30
|
+
export type TrendSliceMetadata<Metadata extends BaseMetadata> = BaseTrendSliceMetadata & Metadata;
|
|
31
|
+
export interface TrendSlice<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> {
|
|
32
|
+
min: number;
|
|
33
|
+
max: number;
|
|
34
|
+
metadata: TrendSliceMetadata<Metadata>;
|
|
35
|
+
}
|
|
36
|
+
export interface BasePieSlice {
|
|
37
|
+
status: TestStatus;
|
|
38
|
+
count: number;
|
|
39
|
+
}
|
|
40
|
+
export interface PieSlice extends BasePieSlice {
|
|
41
|
+
d: string | null;
|
|
42
|
+
}
|
|
43
|
+
export type PieChartValues = {
|
|
44
|
+
percentage: number;
|
|
45
|
+
slices: PieSlice[];
|
|
46
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var ChartType;
|
|
2
|
+
(function (ChartType) {
|
|
3
|
+
ChartType["Trend"] = "trend";
|
|
4
|
+
ChartType["Pie"] = "pie";
|
|
5
|
+
ChartType["TreeMap"] = "treemap";
|
|
6
|
+
ChartType["HeatMap"] = "heatmap";
|
|
7
|
+
ChartType["Bar"] = "bar";
|
|
8
|
+
ChartType["Funnel"] = "funnel";
|
|
9
|
+
})(ChartType || (ChartType = {}));
|
|
10
|
+
export var ChartDataType;
|
|
11
|
+
(function (ChartDataType) {
|
|
12
|
+
ChartDataType["Status"] = "status";
|
|
13
|
+
ChartDataType["Severity"] = "severity";
|
|
14
|
+
})(ChartDataType || (ChartDataType = {}));
|
|
15
|
+
export var ChartMode;
|
|
16
|
+
(function (ChartMode) {
|
|
17
|
+
ChartMode["Raw"] = "raw";
|
|
18
|
+
ChartMode["Percent"] = "percent";
|
|
19
|
+
})(ChartMode || (ChartMode = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PieArcDatum } from "d3-shape";
|
|
2
|
+
import type { BasePieSlice, PieChartValues, Statistic } from "../index.js";
|
|
3
|
+
export declare const getPercentage: (value: number, total: number) => number;
|
|
4
|
+
export declare const d3Arc: import("d3-shape").Arc<any, PieArcDatum<BasePieSlice>>;
|
|
5
|
+
export declare const d3Pie: import("d3-shape").Pie<any, BasePieSlice>;
|
|
6
|
+
export declare const getPieChartValues: (stats: Statistic) => PieChartValues;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { arc, pie } from "d3-shape";
|
|
2
|
+
import { statusesList } from "../constants.js";
|
|
3
|
+
export const getPercentage = (value, total) => Math.floor((value / total) * 10000) / 100;
|
|
4
|
+
export const d3Arc = arc().innerRadius(40).outerRadius(50).cornerRadius(2).padAngle(0.03);
|
|
5
|
+
export const d3Pie = pie()
|
|
6
|
+
.value((d) => d.count)
|
|
7
|
+
.padAngle(0.03)
|
|
8
|
+
.sortValues((a, b) => a - b);
|
|
9
|
+
export const getPieChartValues = (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
|
|
18
|
+
.map((arcData) => {
|
|
19
|
+
const d = d3Arc(arcData);
|
|
20
|
+
if (!d) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
d,
|
|
25
|
+
...arcData.data,
|
|
26
|
+
};
|
|
27
|
+
})
|
|
28
|
+
.filter((item) => item !== null);
|
|
29
|
+
const percentage = getPercentage(stats.passed ?? 0, stats.total);
|
|
30
|
+
return {
|
|
31
|
+
slices,
|
|
32
|
+
percentage,
|
|
33
|
+
};
|
|
34
|
+
};
|
package/dist/ci.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum CiType {
|
|
2
|
+
Amazon = "amazon",
|
|
3
|
+
Azure = "azure",
|
|
4
|
+
Bitbucket = "bitbucket",
|
|
5
|
+
Circle = "circle",
|
|
6
|
+
Drone = "drone",
|
|
7
|
+
Github = "github",
|
|
8
|
+
Gitlab = "gitlab",
|
|
9
|
+
Jenkins = "jenkins"
|
|
10
|
+
}
|
|
11
|
+
export interface CiDescriptor {
|
|
12
|
+
type: CiType;
|
|
13
|
+
detected: boolean;
|
|
14
|
+
jobUid: string;
|
|
15
|
+
jobUrl: string;
|
|
16
|
+
jobName: string;
|
|
17
|
+
jobRunUid: string;
|
|
18
|
+
jobRunUrl: string;
|
|
19
|
+
jobRunName: string;
|
|
20
|
+
jobRunBranch: string;
|
|
21
|
+
pullRequestName: string;
|
|
22
|
+
pullRequestUrl: string;
|
|
23
|
+
}
|
package/dist/ci.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var CiType;
|
|
2
|
+
(function (CiType) {
|
|
3
|
+
CiType["Amazon"] = "amazon";
|
|
4
|
+
CiType["Azure"] = "azure";
|
|
5
|
+
CiType["Bitbucket"] = "bitbucket";
|
|
6
|
+
CiType["Circle"] = "circle";
|
|
7
|
+
CiType["Drone"] = "drone";
|
|
8
|
+
CiType["Github"] = "github";
|
|
9
|
+
CiType["Gitlab"] = "gitlab";
|
|
10
|
+
CiType["Jenkins"] = "jenkins";
|
|
11
|
+
})(CiType || (CiType = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type * from "./aggregate.js";
|
|
2
2
|
export * from "./constants.js";
|
|
3
|
+
export * from "./ci.js";
|
|
3
4
|
export type * from "./environment.js";
|
|
4
5
|
export type * from "./history.js";
|
|
5
6
|
export type * from "./known.js";
|
|
@@ -17,3 +18,5 @@ export * from "./utils/label.js";
|
|
|
17
18
|
export * from "./utils/testplan.js";
|
|
18
19
|
export * from "./utils/status.js";
|
|
19
20
|
export * from "./utils/environment.js";
|
|
21
|
+
export * from "./charts/types.js";
|
|
22
|
+
export * from "./charts/utils.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./constants.js";
|
|
2
|
+
export * from "./ci.js";
|
|
2
3
|
export * from "./utils/step.js";
|
|
3
4
|
export * from "./utils/time.js";
|
|
4
5
|
export * from "./utils/comparator.js";
|
|
@@ -7,3 +8,5 @@ export * from "./utils/label.js";
|
|
|
7
8
|
export * from "./utils/testplan.js";
|
|
8
9
|
export * from "./utils/status.js";
|
|
9
10
|
export * from "./utils/environment.js";
|
|
11
|
+
export * from "./charts/types.js";
|
|
12
|
+
export * from "./charts/utils.js";
|
package/dist/model.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core-api",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.18",
|
|
4
4
|
"description": "Allure Core API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,15 +25,19 @@
|
|
|
25
25
|
"eslint:format": "eslint --fix ./src/**/*.{js,jsx,ts,tsx}",
|
|
26
26
|
"test": "rimraf ./out && vitest run"
|
|
27
27
|
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"d3-shape": "^3.2.0"
|
|
30
|
+
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@stylistic/eslint-plugin": "^2.6.1",
|
|
33
|
+
"@types/d3-shape": "^3.1.6",
|
|
30
34
|
"@types/eslint": "^8.56.11",
|
|
31
35
|
"@types/node": "^20.17.9",
|
|
32
36
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
33
37
|
"@typescript-eslint/parser": "^8.0.0",
|
|
34
38
|
"@vitest/runner": "^2.1.9",
|
|
35
39
|
"@vitest/snapshot": "^2.1.9",
|
|
36
|
-
"allure-vitest": "^3.
|
|
40
|
+
"allure-vitest": "^3.3.3",
|
|
37
41
|
"eslint": "^8.57.0",
|
|
38
42
|
"eslint-config-prettier": "^9.1.0",
|
|
39
43
|
"eslint-plugin-import": "^2.29.1",
|