@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.
@@ -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: {},
@@ -1,4 +1,4 @@
1
- import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, DEFAULT_CHART_HISTORY_LIMIT, } from "@allurereport/web-commons";
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
- const html = compile({
143
- headTags: headTags.join("\n"),
144
- bodyTags: bodyTags.join("\n"),
145
- reportFilesScript: createReportDataScript(reportDataFiles),
146
- reportOptions: JSON.stringify(reportOptions),
147
- analyticsEnable: true,
148
- allureVersion,
149
- reportUuid,
150
- reportName,
151
- singleFile: payload.singleFile,
152
- });
153
- await reportFiles.addFile("index.html", Buffer.from(html, "utf8"));
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
@@ -1 +1,2 @@
1
+ export type { DashboardPluginOptions } from "./model.js";
1
2
  export { DashboardPlugin as default } from "./plugin.js";
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 type ChartMode = "raw" | "percent";
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 { AllureStore, Plugin, PluginContext, PluginSummary } from "@allurereport/plugin-api";
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
  }
@@ -1,5 +1,5 @@
1
1
  import type { SeverityLevel, TestStatus } from "@allurereport/core-api";
2
- import type { BaseTrendSliceMetadata, GenericTrendChartData, TrendChartOptions } from "../model.js";
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[]>;
@@ -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: (value / total) * 100,
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 = "raw", metadata = {} } = chartOptions;
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 === "percent"
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.15",
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.15",
36
- "@allurereport/plugin-api": "3.0.0-beta.15",
37
- "@allurereport/web-commons": "3.0.0-beta.15",
38
- "@allurereport/web-dashboard": "3.0.0-beta.15",
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.8",
50
- "allure-vitest": "^3.0.9",
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.8"
60
+ "vitest": "^2.1.9"
61
61
  }
62
62
  }