@allurereport/plugin-classic 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/generators.js +24 -15
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +7 -0
- package/package.json +7 -7
- package/dist/charts.d.ts +0 -14
- package/dist/charts.js +0 -26
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareBy, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
1
|
+
import { compareBy, getPieChartValues, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
2
2
|
import { createTreeByCategories, createTreeByLabels, filterTree, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
3
3
|
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
|
|
4
4
|
import Handlebars from "handlebars";
|
|
@@ -6,7 +6,6 @@ import { readFile } from "node:fs/promises";
|
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { basename, join } from "node:path";
|
|
8
8
|
import { matchCategories } from "./categories.js";
|
|
9
|
-
import { getChartData } from "./charts.js";
|
|
10
9
|
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
11
10
|
const require = createRequire(import.meta.url);
|
|
12
11
|
const template = `<!DOCTYPE html>
|
|
@@ -141,7 +140,7 @@ export const generateStatistic = async (writer, statistic) => {
|
|
|
141
140
|
await writer.writeWidget("allure_statistic.json", statistic);
|
|
142
141
|
};
|
|
143
142
|
export const generatePieChart = async (writer, statistic) => {
|
|
144
|
-
const chartData =
|
|
143
|
+
const chartData = getPieChartValues(statistic);
|
|
145
144
|
await writer.writeWidget("allure_pie_chart.json", chartData);
|
|
146
145
|
};
|
|
147
146
|
export const generateAttachmentsFiles = async (writer, attachmentLinks, contentFunction) => {
|
|
@@ -213,18 +212,28 @@ export const generateStaticFiles = async (payload) => {
|
|
|
213
212
|
allureVersion,
|
|
214
213
|
cacheKey: now.toString(),
|
|
215
214
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
215
|
+
try {
|
|
216
|
+
const html = compile({
|
|
217
|
+
headTags: headTags.join("\n"),
|
|
218
|
+
bodyTags: bodyTags.join("\n"),
|
|
219
|
+
reportFilesScript: createReportDataScript(reportDataFiles),
|
|
220
|
+
reportOptions: JSON.stringify(reportOptions),
|
|
221
|
+
analyticsEnable: true,
|
|
222
|
+
allureVersion,
|
|
223
|
+
reportUuid,
|
|
224
|
+
reportName,
|
|
225
|
+
singleFile: payload.singleFile,
|
|
226
|
+
});
|
|
227
|
+
await reportFiles.addFile("index.html", Buffer.from(html, "utf8"));
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
if (err instanceof RangeError) {
|
|
231
|
+
console.error("The report is too large to be generated in the single file mode!");
|
|
232
|
+
process.exit(1);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
throw err;
|
|
236
|
+
}
|
|
228
237
|
};
|
|
229
238
|
export const generateTreeByCategories = async (writer, treeName, tests) => {
|
|
230
239
|
const visibleTests = tests.filter((test) => !test.hidden);
|
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 { ClassicPluginOptions } from "./model.js";
|
|
3
3
|
export declare class ClassicPlugin 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 _ClassicPlugin_writer, _ClassicPlugin_generate;
|
|
13
13
|
import { getWorstStatus } from "@allurereport/core-api";
|
|
14
|
+
import { convertToSummaryTestResult, } from "@allurereport/plugin-api";
|
|
14
15
|
import { preciseTreeLabels } from "@allurereport/plugin-api";
|
|
15
16
|
import { generateAttachmentsFiles, generateEnvironmentJson, generateHistoryDataPoints, generatePieChart, generateStaticFiles, generateStatistic, generateTestResults, generateTree, generateTreeByCategories, } from "./generators.js";
|
|
16
17
|
import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
|
|
@@ -74,6 +75,9 @@ export class ClassicPlugin {
|
|
|
74
75
|
}
|
|
75
76
|
async info(context, store) {
|
|
76
77
|
const allTrs = (await store.allTestResults()).filter(this.options.filter ? this.options.filter : () => true);
|
|
78
|
+
const newTrs = await store.allNewTestResults();
|
|
79
|
+
const retryTrs = allTrs.filter((tr) => !!tr?.retries?.length);
|
|
80
|
+
const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
|
|
77
81
|
const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
|
|
78
82
|
const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
|
|
79
83
|
const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
|
|
@@ -84,6 +88,9 @@ export class ClassicPlugin {
|
|
|
84
88
|
createdAt,
|
|
85
89
|
duration,
|
|
86
90
|
plugin: "Classic",
|
|
91
|
+
newTests: newTrs.map(convertToSummaryTestResult),
|
|
92
|
+
flakyTests: flakyTrs.map(convertToSummaryTestResult),
|
|
93
|
+
retryTests: retryTrs.map(convertToSummaryTestResult),
|
|
87
94
|
};
|
|
88
95
|
}
|
|
89
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-classic",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.18",
|
|
4
4
|
"description": "The classic version of Allure HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
35
|
-
"@allurereport/web-awesome": "3.0.0-beta.
|
|
36
|
-
"@allurereport/web-classic": "3.0.0-beta.
|
|
37
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
33
|
+
"@allurereport/core-api": "3.0.0-beta.18",
|
|
34
|
+
"@allurereport/plugin-api": "3.0.0-beta.18",
|
|
35
|
+
"@allurereport/web-awesome": "3.0.0-beta.18",
|
|
36
|
+
"@allurereport/web-classic": "3.0.0-beta.18",
|
|
37
|
+
"@allurereport/web-commons": "3.0.0-beta.18",
|
|
38
38
|
"d3-shape": "^3.2.0",
|
|
39
39
|
"handlebars": "^4.7.8"
|
|
40
40
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
47
47
|
"@typescript-eslint/parser": "^8.0.0",
|
|
48
48
|
"@vitest/runner": "^2.1.9",
|
|
49
|
-
"allure-vitest": "^3.
|
|
49
|
+
"allure-vitest": "^3.3.3",
|
|
50
50
|
"eslint": "^8.57.0",
|
|
51
51
|
"eslint-config-prettier": "^9.1.0",
|
|
52
52
|
"eslint-plugin-import": "^2.29.1",
|
package/dist/charts.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Statistic, TestStatus } from "@allurereport/core-api";
|
|
2
|
-
import type { PieArcDatum } from "d3-shape";
|
|
3
|
-
export type TestResultSlice = {
|
|
4
|
-
status: TestStatus;
|
|
5
|
-
count: number;
|
|
6
|
-
};
|
|
7
|
-
export type TestResultChartData = {
|
|
8
|
-
percentage: number;
|
|
9
|
-
slices: TestResultSlice[];
|
|
10
|
-
};
|
|
11
|
-
export declare const d3Arc: import("d3-shape").Arc<any, PieArcDatum<TestResultSlice>>;
|
|
12
|
-
export declare const d3Pie: import("d3-shape").Pie<any, TestResultSlice>;
|
|
13
|
-
export declare const getPercentage: (value: number, total: number) => number;
|
|
14
|
-
export declare const getChartData: (stats: Statistic) => TestResultChartData;
|
package/dist/charts.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { statusesList } from "@allurereport/core-api";
|
|
2
|
-
import { arc, pie } from "d3-shape";
|
|
3
|
-
export const d3Arc = arc().innerRadius(40).outerRadius(50).cornerRadius(2).padAngle(0.03);
|
|
4
|
-
export const d3Pie = pie()
|
|
5
|
-
.value((d) => d.count)
|
|
6
|
-
.padAngle(0.03)
|
|
7
|
-
.sortValues((a, b) => a - b);
|
|
8
|
-
export const getPercentage = (value, total) => Math.floor((value / total) * 10000) / 100;
|
|
9
|
-
export const getChartData = (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.map((arcData) => ({
|
|
18
|
-
d: d3Arc(arcData),
|
|
19
|
-
...arcData.data,
|
|
20
|
-
}));
|
|
21
|
-
const percentage = getPercentage(stats.passed ?? 0, stats.total);
|
|
22
|
-
return {
|
|
23
|
-
slices,
|
|
24
|
-
percentage,
|
|
25
|
-
};
|
|
26
|
-
};
|