@allurereport/plugin-dashboard 3.0.0-beta.15 → 3.0.0-beta.17
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/severityTrend.js +1 -0
- package/dist/charts/statusTrend.js +1 -0
- package/dist/generators.js +23 -13
- package/dist/index.d.ts +1 -0
- package/dist/model.d.ts +5 -1
- package/dist/model.js +5 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +7 -0
- package/dist/utils/trend.d.ts +1 -1
- package/dist/utils/trend.js +5 -3
- package/package.json +8 -8
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag,
|
|
1
|
+
import { DEFAULT_CHART_HISTORY_LIMIT, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import Handlebars from "handlebars";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -139,16 +139,26 @@ export const generateStaticFiles = async (payload) => {
|
|
|
139
139
|
reportUuid,
|
|
140
140
|
allureVersion,
|
|
141
141
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
try {
|
|
143
|
+
const html = compile({
|
|
144
|
+
headTags: headTags.join("\n"),
|
|
145
|
+
bodyTags: bodyTags.join("\n"),
|
|
146
|
+
reportFilesScript: createReportDataScript(reportDataFiles),
|
|
147
|
+
reportOptions: JSON.stringify(reportOptions),
|
|
148
|
+
analyticsEnable: true,
|
|
149
|
+
allureVersion,
|
|
150
|
+
reportUuid,
|
|
151
|
+
reportName,
|
|
152
|
+
singleFile: payload.singleFile,
|
|
153
|
+
});
|
|
154
|
+
await reportFiles.addFile("index.html", Buffer.from(html, "utf8"));
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
if (err instanceof RangeError) {
|
|
158
|
+
console.error("The report is too large to be generated in the single file mode!");
|
|
159
|
+
process.exit(1);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
throw err;
|
|
163
|
+
}
|
|
154
164
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export declare enum ChartData {
|
|
|
7
7
|
Status = "status",
|
|
8
8
|
Severity = "severity"
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export declare enum ChartMode {
|
|
11
|
+
Raw = "raw",
|
|
12
|
+
Percent = "percent"
|
|
13
|
+
}
|
|
11
14
|
export type ChartId = string;
|
|
12
15
|
export type ExecutionIdFn = (executionOrder: number) => string;
|
|
13
16
|
export type ExecutionNameFn = (executionOrder: number) => string;
|
|
@@ -43,6 +46,7 @@ export type TrendSlice<Metadata extends BaseMetadata> = {
|
|
|
43
46
|
export type GenericTrendChartData<Metadata extends BaseMetadata, SeriesType extends string> = {
|
|
44
47
|
type: ChartType.Trend;
|
|
45
48
|
dataType: ChartData;
|
|
49
|
+
mode: ChartMode;
|
|
46
50
|
title?: string;
|
|
47
51
|
points: Record<TrendPointId, TrendPoint>;
|
|
48
52
|
slices: Record<TrendSliceId, TrendSlice<Metadata>>;
|
package/dist/model.js
CHANGED
|
@@ -8,3 +8,8 @@ export var ChartData;
|
|
|
8
8
|
ChartData["Status"] = "status";
|
|
9
9
|
ChartData["Severity"] = "severity";
|
|
10
10
|
})(ChartData || (ChartData = {}));
|
|
11
|
+
export var ChartMode;
|
|
12
|
+
(function (ChartMode) {
|
|
13
|
+
ChartMode["Raw"] = "raw";
|
|
14
|
+
ChartMode["Percent"] = "percent";
|
|
15
|
+
})(ChartMode || (ChartMode = {}));
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AllureStore, type Plugin, type PluginContext, type PluginSummary } from "@allurereport/plugin-api";
|
|
2
2
|
import type { DashboardPluginOptions } from "./model.js";
|
|
3
3
|
export declare class DashboardPlugin implements Plugin {
|
|
4
4
|
#private;
|
package/dist/plugin.js
CHANGED
|
@@ -11,6 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _DashboardPlugin_writer, _DashboardPlugin_generate;
|
|
13
13
|
import { getWorstStatus } from "@allurereport/core-api";
|
|
14
|
+
import { convertToSummaryTestResult, } from "@allurereport/plugin-api";
|
|
14
15
|
import { generateAllCharts, generateStaticFiles } from "./generators.js";
|
|
15
16
|
import { InMemoryDashboardDataWriter, ReportFileDashboardDataWriter } from "./writer.js";
|
|
16
17
|
export class DashboardPlugin {
|
|
@@ -52,6 +53,9 @@ export class DashboardPlugin {
|
|
|
52
53
|
}
|
|
53
54
|
async info(context, store) {
|
|
54
55
|
const allTrs = (await store.allTestResults()).filter(this.options.filter ? this.options.filter : () => true);
|
|
56
|
+
const newTrs = await store.allNewTestResults();
|
|
57
|
+
const retryTrs = allTrs.filter((tr) => !!tr?.retries?.length);
|
|
58
|
+
const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
|
|
55
59
|
const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
|
|
56
60
|
const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
|
|
57
61
|
const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
|
|
@@ -62,6 +66,9 @@ export class DashboardPlugin {
|
|
|
62
66
|
duration,
|
|
63
67
|
createdAt,
|
|
64
68
|
plugin: "Dashboard",
|
|
69
|
+
newTests: newTrs.map(convertToSummaryTestResult),
|
|
70
|
+
flakyTests: flakyTrs.map(convertToSummaryTestResult),
|
|
71
|
+
retryTests: retryTrs.map(convertToSummaryTestResult),
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
}
|
package/dist/utils/trend.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SeverityLevel, TestStatus } from "@allurereport/core-api";
|
|
2
|
-
import type
|
|
2
|
+
import { type BaseTrendSliceMetadata, type GenericTrendChartData, type TrendChartOptions } from "../model.js";
|
|
3
3
|
type TrendDataType = TestStatus | SeverityLevel;
|
|
4
4
|
export declare const createEmptyStats: <T extends TrendDataType>(items: readonly T[]) => Record<T, number>;
|
|
5
5
|
export declare const createEmptySeries: <T extends TrendDataType>(items: readonly T[]) => Record<T, string[]>;
|
package/dist/utils/trend.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChartMode, } from "../model.js";
|
|
1
2
|
export const createEmptyStats = (items) => items.reduce((acc, item) => ({ ...acc, [item]: 0 }), {});
|
|
2
3
|
export const createEmptySeries = (items) => items.reduce((acc, item) => ({ ...acc, [item]: [] }), {});
|
|
3
4
|
export const normalizeStatistic = (statistic, itemType) => {
|
|
@@ -33,7 +34,7 @@ const calculatePercentValues = (stats, executionId, itemType) => {
|
|
|
33
34
|
const value = stats[item] ?? 0;
|
|
34
35
|
points[pointId] = {
|
|
35
36
|
x: executionId,
|
|
36
|
-
y:
|
|
37
|
+
y: value / total,
|
|
37
38
|
};
|
|
38
39
|
series[item].push(pointId);
|
|
39
40
|
});
|
|
@@ -64,10 +65,10 @@ export const mergeTrendDataGeneric = (trendData, trendDataPart, itemType) => {
|
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
67
|
export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
|
|
67
|
-
const { type, dataType, title, mode =
|
|
68
|
+
const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
|
|
68
69
|
const { executionIdAccessor, executionNameAccessor } = metadata;
|
|
69
70
|
const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
|
|
70
|
-
const { points, series } = mode ===
|
|
71
|
+
const { points, series } = mode === ChartMode.Percent
|
|
71
72
|
? calculatePercentValues(stats, executionId, itemType)
|
|
72
73
|
: calculateRawValues(stats, executionId, itemType);
|
|
73
74
|
const slices = {};
|
|
@@ -90,6 +91,7 @@ export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType,
|
|
|
90
91
|
return {
|
|
91
92
|
type,
|
|
92
93
|
dataType,
|
|
94
|
+
mode,
|
|
93
95
|
title,
|
|
94
96
|
points,
|
|
95
97
|
slices,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-dashboard",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.17",
|
|
4
4
|
"description": "Allure Dashboard Plugin – plugin for generating dashboard with a mix of charts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"test": "rimraf ./out && vitest run"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
37
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
38
|
-
"@allurereport/web-dashboard": "3.0.0-beta.
|
|
35
|
+
"@allurereport/core-api": "3.0.0-beta.17",
|
|
36
|
+
"@allurereport/plugin-api": "3.0.0-beta.17",
|
|
37
|
+
"@allurereport/web-commons": "3.0.0-beta.17",
|
|
38
|
+
"@allurereport/web-dashboard": "3.0.0-beta.17",
|
|
39
39
|
"d3-shape": "^3.2.0",
|
|
40
40
|
"handlebars": "^4.7.8"
|
|
41
41
|
},
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@types/node": "^20.17.9",
|
|
47
47
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
48
48
|
"@typescript-eslint/parser": "^8.0.0",
|
|
49
|
-
"@vitest/runner": "^2.1.
|
|
50
|
-
"allure-vitest": "^3.0
|
|
49
|
+
"@vitest/runner": "^2.1.9",
|
|
50
|
+
"allure-vitest": "^3.3.0",
|
|
51
51
|
"eslint": "^8.57.0",
|
|
52
52
|
"eslint-config-prettier": "^9.1.0",
|
|
53
53
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
58
58
|
"rimraf": "^6.0.1",
|
|
59
59
|
"typescript": "^5.6.3",
|
|
60
|
-
"vitest": "^2.1.
|
|
60
|
+
"vitest": "^2.1.9"
|
|
61
61
|
}
|
|
62
62
|
}
|