@allurereport/plugin-classic 3.0.0-beta.8 → 3.0.0
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/README.md +4 -1
- package/dist/categories.d.ts +7 -6
- package/dist/converters.d.ts +5 -11
- package/dist/converters.js +44 -174
- package/dist/generators.d.ts +15 -31
- package/dist/generators.js +202 -216
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -2
- package/dist/model.d.ts +18 -138
- package/dist/model.js +1 -2
- package/dist/plugin.d.ts +7 -5
- package/dist/plugin.js +79 -53
- package/dist/writer.d.ts +9 -9
- package/dist/writer.js +8 -7
- package/package.json +11 -8
- package/dist/tree.d.ts +0 -44
- package/dist/tree.js +0 -112
- package/dist/utils.d.ts +0 -8
- package/dist/utils.js +0 -43
package/dist/generators.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { createBaseUrlScript,
|
|
1
|
+
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
2
|
+
import { createTreeByCategories, createTreeByLabels, filterTree, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
3
|
+
import { getPieChartValues } from "@allurereport/web-commons";
|
|
2
4
|
import Handlebars from "handlebars";
|
|
3
5
|
import { readFile } from "node:fs/promises";
|
|
4
6
|
import { createRequire } from "node:module";
|
|
5
7
|
import { basename, join } from "node:path";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { matchCategories } from "./categories.js";
|
|
9
|
+
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
8
10
|
const require = createRequire(import.meta.url);
|
|
9
11
|
const template = `<!DOCTYPE html>
|
|
10
|
-
<html dir="ltr" lang="
|
|
12
|
+
<html dir="ltr" lang="en">
|
|
11
13
|
<head>
|
|
12
14
|
<meta charset="utf-8">
|
|
13
|
-
<title>{{reportName}}</title>
|
|
15
|
+
<title> {{ reportName }} </title>
|
|
16
|
+
<link rel="icon" href="favicon.ico">
|
|
14
17
|
{{{ headTags }}}
|
|
15
18
|
</head>
|
|
16
19
|
<body>
|
|
17
|
-
<
|
|
18
|
-
<div id="alert"></div>
|
|
19
|
-
<div id="content">
|
|
20
|
-
<span class="spinner">
|
|
21
|
-
<span class="spinner__circle"></span>
|
|
22
|
-
</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div id="popup"></div>
|
|
25
|
-
{{{ bodyTags }}}
|
|
20
|
+
<div id="app"></div>
|
|
26
21
|
${createBaseUrlScript()}
|
|
22
|
+
<script>
|
|
23
|
+
window.allure = window.allure || {};
|
|
24
|
+
</script>
|
|
25
|
+
{{{ bodyTags }}}
|
|
27
26
|
{{#if analyticsEnable}}
|
|
28
27
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LNDJ3J7WT0"></script>
|
|
29
28
|
<script>
|
|
@@ -31,15 +30,15 @@ const template = `<!DOCTYPE html>
|
|
|
31
30
|
function gtag(){dataLayer.push(arguments);}
|
|
32
31
|
gtag('js', new Date());
|
|
33
32
|
gtag('config', 'G-LNDJ3J7WT0', {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
"report": "classic",
|
|
34
|
+
"allureVersion": "{{ allureVersion }}",
|
|
35
|
+
"reportUuid": "{{ reportUuid }}",
|
|
36
|
+
"single_file": "{{singleFile}}"
|
|
38
37
|
});
|
|
39
38
|
</script>
|
|
40
39
|
{{/if}}
|
|
41
40
|
<script>
|
|
42
|
-
window.allureReportOptions = {{{ reportOptions }}}
|
|
41
|
+
window.allureReportOptions = {{{ reportOptions }}}
|
|
43
42
|
</script>
|
|
44
43
|
{{{ reportFilesScript }}}
|
|
45
44
|
</body>
|
|
@@ -50,219 +49,105 @@ export const readTemplateManifest = async (singleFileMode) => {
|
|
|
50
49
|
const templateManifest = await readFile(templateManifestSource, { encoding: "utf-8" });
|
|
51
50
|
return JSON.parse(templateManifest);
|
|
52
51
|
};
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (singleFile) {
|
|
58
|
-
return inserter(`data:${mimeType};base64,${scriptContentBuffer.toString("base64")}`);
|
|
59
|
-
}
|
|
60
|
-
await reportFiles.addFile(fileName, scriptContentBuffer);
|
|
61
|
-
return inserter(fileName);
|
|
62
|
-
};
|
|
63
|
-
export const generateStaticFiles = async (payload) => {
|
|
64
|
-
const { reportName, reportLanguage, singleFile, reportFiles, reportDataFiles, reportUuid, allureVersion } = payload;
|
|
65
|
-
const compile = Handlebars.compile(template);
|
|
66
|
-
const manifest = await readTemplateManifest(singleFile);
|
|
67
|
-
const headTags = [];
|
|
68
|
-
const bodyTags = [];
|
|
69
|
-
for (const key in manifest) {
|
|
70
|
-
const fileName = manifest[key];
|
|
71
|
-
const filePath = require.resolve(join("@allurereport/web-classic/dist", singleFile ? "single" : "multi", fileName));
|
|
72
|
-
if (key === "favicon.ico") {
|
|
73
|
-
const tag = await readManifestEntry({
|
|
74
|
-
fileName,
|
|
75
|
-
singleFile,
|
|
76
|
-
reportFiles,
|
|
77
|
-
inserter: createFaviconLinkTag,
|
|
78
|
-
mimeType: "image/x-icon",
|
|
79
|
-
});
|
|
80
|
-
headTags.push(tag);
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
if (key === "main.css") {
|
|
84
|
-
const tag = await readManifestEntry({
|
|
85
|
-
fileName,
|
|
86
|
-
singleFile,
|
|
87
|
-
reportFiles,
|
|
88
|
-
inserter: createStylesLinkTag,
|
|
89
|
-
mimeType: "text/css",
|
|
90
|
-
});
|
|
91
|
-
headTags.push(tag);
|
|
92
|
-
continue;
|
|
52
|
+
const createBreadcrumbs = (convertedTr) => {
|
|
53
|
+
const labelsByType = convertedTr.labels.reduce((acc, label) => {
|
|
54
|
+
if (!acc[label.name]) {
|
|
55
|
+
acc[label.name] = [];
|
|
93
56
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
57
|
+
acc[label.name].push(label.value || "");
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
const parentSuites = labelsByType.parentSuite || [""];
|
|
61
|
+
const suites = labelsByType.suite || [""];
|
|
62
|
+
const subSuites = labelsByType.subSuite || [""];
|
|
63
|
+
return parentSuites.reduce((acc, parentSuite) => {
|
|
64
|
+
suites.forEach((suite) => {
|
|
65
|
+
subSuites.forEach((subSuite) => {
|
|
66
|
+
const path = [parentSuite, suite, subSuite].filter(Boolean);
|
|
67
|
+
if (path.length > 0) {
|
|
68
|
+
acc.push(path);
|
|
69
|
+
}
|
|
101
70
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (singleFile) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
const fileContent = await readFile(filePath);
|
|
109
|
-
await reportFiles.addFile(basename(filePath), fileContent);
|
|
110
|
-
}
|
|
111
|
-
const reportOptions = {
|
|
112
|
-
reportName: reportName ?? "Allure Report",
|
|
113
|
-
reportLanguage: reportLanguage ?? "en",
|
|
114
|
-
createdAt: Date.now(),
|
|
115
|
-
};
|
|
116
|
-
const html = compile({
|
|
117
|
-
headTags: headTags.join("\n"),
|
|
118
|
-
bodyTags: bodyTags.join("\n"),
|
|
119
|
-
reportFilesScript: createReportDataScript(reportDataFiles),
|
|
120
|
-
reportOptions: JSON.stringify(reportOptions),
|
|
121
|
-
analyticsEnable: true,
|
|
122
|
-
allureVersion,
|
|
123
|
-
reportLanguage,
|
|
124
|
-
reportUuid,
|
|
125
|
-
reportName,
|
|
126
|
-
singleFile,
|
|
127
|
-
});
|
|
128
|
-
await reportFiles.addFile("index.html", Buffer.from(html, "utf8"));
|
|
129
|
-
};
|
|
130
|
-
export const generateTree = async (writer, name, labelNames, tests) => {
|
|
131
|
-
const fileName = `${name}.json`;
|
|
132
|
-
const data = createTree(tests, byLabels(labelNames));
|
|
133
|
-
await writer.writeData(fileName, data);
|
|
134
|
-
const widgetData = createWidget(data);
|
|
135
|
-
await writer.writeWidget(fileName, widgetData);
|
|
136
|
-
};
|
|
137
|
-
export const generatePackagesData = async (writer, tests) => {
|
|
138
|
-
const classifier = (test) => {
|
|
139
|
-
return (test.labels
|
|
140
|
-
.find((label) => label.name === "package")
|
|
141
|
-
?.value?.split(".")
|
|
142
|
-
?.map((group) => ({
|
|
143
|
-
groups: [group],
|
|
144
|
-
})) ?? []);
|
|
145
|
-
};
|
|
146
|
-
const data = createTree(tests, classifier);
|
|
147
|
-
const packagesData = collapseTree(data);
|
|
148
|
-
await writer.writeData("packages.json", packagesData);
|
|
149
|
-
};
|
|
150
|
-
export const generateCategoriesData = async (writer, tests) => {
|
|
151
|
-
const classifier = (test) => {
|
|
152
|
-
const byMessage = { groups: [test.statusMessage ?? "No message"] };
|
|
153
|
-
const categories = test.extra.categories;
|
|
154
|
-
if (!categories || categories.length === 0) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
const groups = categories.map((c) => c.name);
|
|
158
|
-
return [{ groups }, byMessage];
|
|
159
|
-
};
|
|
160
|
-
const data = createTree(tests, classifier);
|
|
161
|
-
const fileName = "categories.json";
|
|
162
|
-
await writer.writeData(fileName, data);
|
|
163
|
-
const widgetData = createWidget(data);
|
|
164
|
-
await writer.writeWidget(fileName, widgetData);
|
|
165
|
-
};
|
|
166
|
-
export const generateTimelineData = async (writer, tests) => {
|
|
167
|
-
const classifier = (test) => {
|
|
168
|
-
return [{ groups: [test.hostId ?? "Default"] }, { groups: [test.threadId ?? "Default"] }];
|
|
169
|
-
};
|
|
170
|
-
const data = createTree(tests, classifier);
|
|
171
|
-
await writer.writeData("timeline.json", data);
|
|
71
|
+
});
|
|
72
|
+
return acc;
|
|
73
|
+
}, []);
|
|
172
74
|
};
|
|
173
|
-
export const generateTestResults = async (writer,
|
|
174
|
-
|
|
175
|
-
|
|
75
|
+
export const generateTestResults = async (writer, store) => {
|
|
76
|
+
const allTr = await store.allTestResults({ includeHidden: true });
|
|
77
|
+
let convertedTrs = [];
|
|
78
|
+
for (const tr of allTr) {
|
|
79
|
+
const trFixtures = await store.fixturesByTrId(tr.id);
|
|
80
|
+
const convertedTrFixtures = trFixtures.map(convertFixtureResult);
|
|
81
|
+
const convertedTr = convertTestResult(tr);
|
|
82
|
+
const { error, status, flaky } = convertedTr;
|
|
83
|
+
const categories = (await store.metadataByKey("allure2_categories")) ?? [];
|
|
84
|
+
const matchedCategories = matchCategories(categories, {
|
|
85
|
+
message: error?.message,
|
|
86
|
+
trace: error?.trace,
|
|
87
|
+
status,
|
|
88
|
+
flaky,
|
|
89
|
+
});
|
|
90
|
+
convertedTr.categories = matchedCategories;
|
|
91
|
+
convertedTr.history = (await store.historyByTrId(tr.id)) ?? [];
|
|
92
|
+
convertedTr.retries = await store.retriesByTrId(tr.id);
|
|
93
|
+
convertedTr.retry = convertedTr.retries.length > 0;
|
|
94
|
+
convertedTr.setup = convertedTrFixtures.filter((f) => f.type === "before");
|
|
95
|
+
convertedTr.teardown = convertedTrFixtures.filter((f) => f.type === "after");
|
|
96
|
+
convertedTr.attachments = (await store.attachmentsByTrId(tr.id)).map((attachment) => ({
|
|
97
|
+
link: attachment,
|
|
98
|
+
type: "attachment",
|
|
99
|
+
}));
|
|
100
|
+
convertedTr.breadcrumbs = createBreadcrumbs(convertedTr);
|
|
101
|
+
convertedTrs.push(convertedTr);
|
|
176
102
|
}
|
|
103
|
+
convertedTrs = convertedTrs.sort(nullsLast(compareBy("start", ordinal()))).map((tr, idx) => ({
|
|
104
|
+
...tr,
|
|
105
|
+
order: idx + 1,
|
|
106
|
+
}));
|
|
107
|
+
for (const convertedTr of convertedTrs) {
|
|
108
|
+
await writer.writeTestCase(convertedTr);
|
|
109
|
+
}
|
|
110
|
+
await writer.writeWidget("nav.json", convertedTrs.filter(({ hidden }) => !hidden).map(({ id }) => id));
|
|
111
|
+
return convertedTrs;
|
|
177
112
|
};
|
|
178
|
-
export const
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
.filter((test) => !test.hidden)
|
|
183
|
-
.forEach((test) => {
|
|
184
|
-
updateStatistic(statistic, test);
|
|
185
|
-
updateTime(time, test);
|
|
186
|
-
});
|
|
187
|
-
const data = {
|
|
188
|
-
reportName,
|
|
189
|
-
statistic,
|
|
190
|
-
time,
|
|
191
|
-
};
|
|
192
|
-
await writer.writeWidget("summary.json", data);
|
|
193
|
-
};
|
|
194
|
-
export const generateEnvironmentJson = async (writer, env) => {
|
|
195
|
-
await writer.writeWidget("environment.json", env);
|
|
196
|
-
};
|
|
197
|
-
export const generateExecutorJson = async (writer, executor) => {
|
|
198
|
-
await writer.writeWidget("executors.json", executor ? [executor] : []);
|
|
199
|
-
};
|
|
200
|
-
export const generateDefaultWidgetData = async (writer, tests, ...fileNames) => {
|
|
201
|
-
const statusChartData = tests
|
|
202
|
-
.filter((test) => !test.hidden)
|
|
203
|
-
.map(({ uid, name, status, time, extra: { severity = "normal" } }) => {
|
|
113
|
+
export const generateTree = async (writer, treeName, labels, tests) => {
|
|
114
|
+
const visibleTests = tests.filter((test) => !test.hidden);
|
|
115
|
+
const tree = createTreeByLabels(visibleTests, labels, ({ id, name, status, duration, flaky, transition, start, retries }) => {
|
|
116
|
+
const retriesCount = retries?.length ?? 0;
|
|
204
117
|
return {
|
|
205
|
-
|
|
118
|
+
nodeId: id,
|
|
119
|
+
retry: Boolean(retriesCount),
|
|
120
|
+
retriesCount,
|
|
206
121
|
name,
|
|
207
122
|
status,
|
|
208
|
-
|
|
209
|
-
|
|
123
|
+
duration,
|
|
124
|
+
flaky,
|
|
125
|
+
transition,
|
|
126
|
+
start,
|
|
210
127
|
};
|
|
128
|
+
}, undefined, (group, leaf) => {
|
|
129
|
+
incrementStatistic(group.statistic, leaf.status);
|
|
211
130
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
131
|
+
filterTree(tree, (leaf) => !leaf.hidden);
|
|
132
|
+
sortTree(tree, nullsLast(compareBy("start", ordinal())));
|
|
133
|
+
transformTree(tree, (leaf, idx) => ({ ...leaf, groupOrder: idx + 1 }));
|
|
134
|
+
await writer.writeWidget(`${treeName}.json`, tree);
|
|
215
135
|
};
|
|
216
|
-
export const
|
|
217
|
-
|
|
218
|
-
await writer.writeWidget(fileName, [
|
|
219
|
-
{
|
|
220
|
-
uid: "invalid",
|
|
221
|
-
name: "invalid",
|
|
222
|
-
statistic: { total: 0 },
|
|
223
|
-
},
|
|
224
|
-
]);
|
|
225
|
-
}
|
|
136
|
+
export const generateEnvironmentJson = async (writer, env) => {
|
|
137
|
+
await writer.writeWidget("allure_environment.json", env);
|
|
226
138
|
};
|
|
227
|
-
export const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
const history = historyDataPoints.map((point) => {
|
|
235
|
-
const stat = { total: 0 };
|
|
236
|
-
Object.values(point.testResults).forEach((testResult) => {
|
|
237
|
-
updateStatistic(stat, testResult);
|
|
238
|
-
});
|
|
239
|
-
return {
|
|
240
|
-
data: stat,
|
|
241
|
-
timestamp: point.timestamp,
|
|
242
|
-
reportName: point.name,
|
|
243
|
-
};
|
|
244
|
-
});
|
|
245
|
-
history
|
|
246
|
-
.sort((a, b) => b.timestamp - a.timestamp)
|
|
247
|
-
.forEach((element, index) => {
|
|
248
|
-
element.buildOrder = history.length - index;
|
|
249
|
-
});
|
|
250
|
-
const data = [
|
|
251
|
-
{
|
|
252
|
-
data: statistic,
|
|
253
|
-
timestamp: new Date().getTime(),
|
|
254
|
-
buildOrder: history.length + 1,
|
|
255
|
-
reportName: reportName,
|
|
256
|
-
},
|
|
257
|
-
...history,
|
|
258
|
-
];
|
|
259
|
-
await writer.writeWidget("history-trend.json", data);
|
|
139
|
+
export const generateStatistic = async (writer, statistic) => {
|
|
140
|
+
await writer.writeWidget("allure_statistic.json", statistic);
|
|
141
|
+
};
|
|
142
|
+
export const generatePieChart = async (writer, statistic) => {
|
|
143
|
+
const chartData = getPieChartValues(statistic);
|
|
144
|
+
await writer.writeWidget("allure_pie_chart.json", chartData);
|
|
260
145
|
};
|
|
261
|
-
export const
|
|
146
|
+
export const generateAttachmentsFiles = async (writer, attachmentLinks, contentFunction) => {
|
|
262
147
|
const result = new Map();
|
|
263
148
|
for (const { id, ext, ...link } of attachmentLinks) {
|
|
264
149
|
if (link.missed) {
|
|
265
|
-
|
|
150
|
+
return;
|
|
266
151
|
}
|
|
267
152
|
const content = await contentFunction(id);
|
|
268
153
|
if (!content) {
|
|
@@ -274,3 +159,104 @@ export const generateAttachmentsData = async (writer, attachmentLinks, contentFu
|
|
|
274
159
|
}
|
|
275
160
|
return result;
|
|
276
161
|
};
|
|
162
|
+
export const generateHistoryDataPoints = async (writer, store) => {
|
|
163
|
+
const result = new Map();
|
|
164
|
+
const allHistoryPoints = await store.allHistoryDataPoints();
|
|
165
|
+
for (const historyPoint of allHistoryPoints.slice(0, 6)) {
|
|
166
|
+
const src = `history/${historyPoint.uuid}.json`;
|
|
167
|
+
await writer.writeData(src, historyPoint);
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
};
|
|
171
|
+
export const generateStaticFiles = async (payload) => {
|
|
172
|
+
const { reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "auto", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, } = payload;
|
|
173
|
+
const compile = Handlebars.compile(template);
|
|
174
|
+
const manifest = await readTemplateManifest(payload.singleFile);
|
|
175
|
+
const headTags = [];
|
|
176
|
+
const bodyTags = [];
|
|
177
|
+
if (!payload.singleFile) {
|
|
178
|
+
for (const key in manifest) {
|
|
179
|
+
const fileName = manifest[key];
|
|
180
|
+
const filePath = require.resolve(join("@allurereport/web-classic/dist", singleFile ? "single" : "multi", fileName));
|
|
181
|
+
if (key.includes(".woff")) {
|
|
182
|
+
headTags.push(createFontLinkTag(fileName));
|
|
183
|
+
}
|
|
184
|
+
if (key === "main.css") {
|
|
185
|
+
headTags.push(createStylesLinkTag(fileName));
|
|
186
|
+
}
|
|
187
|
+
if (key === "main.js") {
|
|
188
|
+
bodyTags.push(createScriptTag(fileName));
|
|
189
|
+
}
|
|
190
|
+
if (singleFile) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const fileContent = await readFile(filePath);
|
|
194
|
+
await reportFiles.addFile(basename(filePath), fileContent);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const mainJs = manifest["main.js"];
|
|
199
|
+
const mainJsSource = require.resolve(`@allurereport/web-classic/dist/single/${mainJs}`);
|
|
200
|
+
const mainJsContentBuffer = await readFile(mainJsSource);
|
|
201
|
+
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
|
|
202
|
+
}
|
|
203
|
+
const now = Date.now();
|
|
204
|
+
const reportOptions = {
|
|
205
|
+
reportName,
|
|
206
|
+
logo,
|
|
207
|
+
theme,
|
|
208
|
+
reportLanguage,
|
|
209
|
+
createdAt: now,
|
|
210
|
+
reportUuid,
|
|
211
|
+
groupBy: groupBy?.length ? groupBy : ["parentSuite", "suite", "subSuite"],
|
|
212
|
+
allureVersion,
|
|
213
|
+
cacheKey: now.toString(),
|
|
214
|
+
};
|
|
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
|
+
}
|
|
234
|
+
throw err;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
export const generateTreeByCategories = async (writer, treeName, tests) => {
|
|
238
|
+
const visibleTests = tests.filter((test) => !test.hidden);
|
|
239
|
+
const tree = createTreeByCategories(visibleTests, ({ id, name, status, duration, flaky, transition, start, retries }) => {
|
|
240
|
+
const retriesCount = retries?.length ?? 0;
|
|
241
|
+
return {
|
|
242
|
+
nodeId: id,
|
|
243
|
+
retry: Boolean(retriesCount),
|
|
244
|
+
retriesCount,
|
|
245
|
+
name,
|
|
246
|
+
status,
|
|
247
|
+
duration,
|
|
248
|
+
flaky,
|
|
249
|
+
transition,
|
|
250
|
+
start,
|
|
251
|
+
};
|
|
252
|
+
}, undefined, (group, leaf) => {
|
|
253
|
+
incrementStatistic(group.statistic, leaf.status);
|
|
254
|
+
});
|
|
255
|
+
filterTree(tree, (leaf) => !leaf.hidden);
|
|
256
|
+
sortTree(tree, nullsLast(compareBy("start", ordinal())));
|
|
257
|
+
transformTree(tree, (leaf, idx) => ({
|
|
258
|
+
...leaf,
|
|
259
|
+
groupOrder: idx + 1,
|
|
260
|
+
}));
|
|
261
|
+
await writer.writeWidget(`${treeName}.json`, tree);
|
|
262
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
export type { ClassicPluginOptions } from "./model.js";
|
|
2
|
+
export { ClassicPlugin as default } from "./plugin.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Allure2Plugin;
|
|
1
|
+
export { ClassicPlugin as default } from "./plugin.js";
|
package/dist/model.d.ts
CHANGED
|
@@ -1,146 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
name?: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
type?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface Allure2Parameter {
|
|
18
|
-
name?: string;
|
|
19
|
-
value?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface Allure2Attachment {
|
|
22
|
-
uid: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
source?: string;
|
|
25
|
-
type?: string;
|
|
26
|
-
size?: number;
|
|
27
|
-
}
|
|
28
|
-
export interface Allure2Step {
|
|
29
|
-
name: string;
|
|
30
|
-
time: Allure2Time;
|
|
31
|
-
status: Allure2Status;
|
|
32
|
-
statusMessage?: string;
|
|
33
|
-
statusTrace?: string;
|
|
34
|
-
steps: Allure2Step[];
|
|
35
|
-
attachments: Allure2Attachment[];
|
|
36
|
-
parameters: Allure2Parameter[];
|
|
37
|
-
stepsCount: number;
|
|
38
|
-
attachmentsCount: number;
|
|
39
|
-
shouldDisplayMessage: boolean;
|
|
40
|
-
hasContent: boolean;
|
|
41
|
-
attachmentStep: boolean;
|
|
42
|
-
}
|
|
43
|
-
export type Allure2StageResult = Allure2Step | Omit<Allure2Step, "name">;
|
|
44
|
-
export interface Allure2TestResult {
|
|
45
|
-
uid: string;
|
|
46
|
-
name: string;
|
|
47
|
-
fullName?: string;
|
|
48
|
-
historyId?: string;
|
|
49
|
-
testId?: string;
|
|
50
|
-
time: Allure2Time;
|
|
51
|
-
description?: string;
|
|
52
|
-
descriptionHtml?: string;
|
|
53
|
-
status: Allure2Status;
|
|
54
|
-
statusMessage?: string;
|
|
55
|
-
statusTrace?: string;
|
|
56
|
-
flaky: boolean;
|
|
57
|
-
newFailed: boolean;
|
|
58
|
-
newBroken: boolean;
|
|
59
|
-
newPassed: boolean;
|
|
60
|
-
retriesCount: number;
|
|
61
|
-
retriesStatusChange: boolean;
|
|
62
|
-
beforeStages: Allure2StageResult[];
|
|
63
|
-
testStage: Allure2StageResult;
|
|
64
|
-
afterStages: Allure2StageResult[];
|
|
65
|
-
labels: Allure2Label[];
|
|
66
|
-
parameters: Allure2Parameter[];
|
|
67
|
-
links: Allure2Link[];
|
|
68
|
-
hostId?: string;
|
|
69
|
-
threadId?: string;
|
|
70
|
-
hidden: boolean;
|
|
71
|
-
retry: boolean;
|
|
72
|
-
extra: {
|
|
73
|
-
[key: string]: any;
|
|
1
|
+
import type { TestResult, TestStatus } from "@allurereport/core-api";
|
|
2
|
+
export type ClassicOptions = {
|
|
3
|
+
reportName?: string;
|
|
4
|
+
singleFile?: boolean;
|
|
5
|
+
logo?: string;
|
|
6
|
+
theme?: "light" | "dark" | "auto";
|
|
7
|
+
reportLanguage?: "en";
|
|
8
|
+
groupBy?: string[];
|
|
9
|
+
ci?: {
|
|
10
|
+
type: "github" | "jenkins";
|
|
11
|
+
url: string;
|
|
12
|
+
name: string;
|
|
74
13
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
duration?: number;
|
|
81
|
-
minDuration?: number;
|
|
82
|
-
maxDuration?: number;
|
|
83
|
-
sumDuration?: number;
|
|
84
|
-
}
|
|
85
|
-
export interface SummaryData {
|
|
86
|
-
reportName: string;
|
|
87
|
-
statistic: Statistic;
|
|
88
|
-
time: GroupTime;
|
|
89
|
-
}
|
|
90
|
-
export type Allure2SeverityLevel = "blocker" | "critical" | "normal" | "minor" | "trivial";
|
|
91
|
-
export declare const severityValues: Allure2SeverityLevel[];
|
|
92
|
-
export interface StatusChartData {
|
|
93
|
-
uid: string;
|
|
94
|
-
name: string;
|
|
95
|
-
time: Allure2Time;
|
|
96
|
-
status: Allure2Status;
|
|
97
|
-
severity: Allure2SeverityLevel;
|
|
98
|
-
}
|
|
99
|
-
export interface Allure2Category {
|
|
14
|
+
filter?: (tr: TestResult) => boolean;
|
|
15
|
+
};
|
|
16
|
+
export type TemplateManifest = Record<string, string>;
|
|
17
|
+
export type ClassicPluginOptions = ClassicOptions;
|
|
18
|
+
export interface ClassicCategory {
|
|
100
19
|
name: string;
|
|
101
20
|
description?: string;
|
|
102
21
|
descriptionHtml?: string;
|
|
103
22
|
messageRegex?: string;
|
|
104
23
|
traceRegex?: string;
|
|
105
|
-
matchedStatuses?:
|
|
24
|
+
matchedStatuses?: TestStatus[];
|
|
106
25
|
flaky?: boolean;
|
|
107
26
|
}
|
|
108
|
-
export interface Allure2RetryItem {
|
|
109
|
-
uid: string;
|
|
110
|
-
status: Allure2Status;
|
|
111
|
-
statusDetails?: string;
|
|
112
|
-
time: Allure2Time;
|
|
113
|
-
}
|
|
114
|
-
export interface Allure2HistoryItem {
|
|
115
|
-
uid: string;
|
|
116
|
-
reportUrl: string;
|
|
117
|
-
status: Allure2Status;
|
|
118
|
-
statusDetails?: string;
|
|
119
|
-
time: Allure2Time;
|
|
120
|
-
}
|
|
121
|
-
export interface Allure2HistoryData {
|
|
122
|
-
statistic: Statistic;
|
|
123
|
-
items: Allure2HistoryItem[];
|
|
124
|
-
}
|
|
125
|
-
export interface Allure2HistoryTrendItem {
|
|
126
|
-
data: Statistic;
|
|
127
|
-
buildOrder?: number;
|
|
128
|
-
reportUrl?: string;
|
|
129
|
-
reportName?: string;
|
|
130
|
-
}
|
|
131
|
-
export type Allure2Options = {
|
|
132
|
-
reportName?: string;
|
|
133
|
-
singleFile?: boolean;
|
|
134
|
-
reportLanguage?: string;
|
|
135
|
-
};
|
|
136
|
-
export type Allure2PluginOptions = Allure2Options;
|
|
137
|
-
export interface Allure2ExecutorInfo {
|
|
138
|
-
name: string;
|
|
139
|
-
type: string;
|
|
140
|
-
url: string;
|
|
141
|
-
buildOrder: number;
|
|
142
|
-
buildName: string;
|
|
143
|
-
buildUrl: string;
|
|
144
|
-
reportName: string;
|
|
145
|
-
reportUrl: string;
|
|
146
|
-
}
|
package/dist/model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export const severityValues = ["blocker", "critical", "normal", "minor", "trivial"];
|
|
1
|
+
export {};
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type AllureStore, type Plugin, type PluginContext } from "@allurereport/plugin-api";
|
|
2
|
-
import type {
|
|
3
|
-
export declare class
|
|
1
|
+
import { type AllureStore, type Plugin, type PluginContext, type PluginSummary } from "@allurereport/plugin-api";
|
|
2
|
+
import type { ClassicPluginOptions } from "./model.js";
|
|
3
|
+
export declare class ClassicPlugin implements Plugin {
|
|
4
4
|
#private;
|
|
5
|
-
readonly options:
|
|
6
|
-
constructor(options?:
|
|
5
|
+
readonly options: ClassicPluginOptions;
|
|
6
|
+
constructor(options?: ClassicPluginOptions);
|
|
7
|
+
start: (context: PluginContext) => Promise<void>;
|
|
7
8
|
update: (context: PluginContext, store: AllureStore) => Promise<void>;
|
|
8
9
|
done: (context: PluginContext, store: AllureStore) => Promise<void>;
|
|
10
|
+
info(context: PluginContext, store: AllureStore): Promise<PluginSummary>;
|
|
9
11
|
}
|