@allurereport/plugin-awesome 3.3.1 → 3.4.1
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/categories.js +16 -10
- package/dist/converters.d.ts +3 -1
- package/dist/converters.js +5 -4
- package/dist/generateTimeline.d.ts +2 -2
- package/dist/generateTimeline.js +7 -5
- package/dist/generators.d.ts +5 -3
- package/dist/generators.js +16 -16
- package/dist/plugin.js +62 -16
- package/dist/writer.js +9 -9
- package/package.json +20 -31
- package/dist/environments.d.ts +0 -3
- package/dist/environments.js +0 -8
package/dist/categories.js
CHANGED
|
@@ -40,7 +40,7 @@ export const applyCategoriesToTestResults = (tests, categories) => {
|
|
|
40
40
|
tr.categories = [];
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
|
-
tr.categories = [{ name: matched.name }];
|
|
43
|
+
tr.categories = [{ id: matched.id, name: matched.name }];
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
const extractGroupValue = (selector, testResult) => {
|
|
@@ -115,8 +115,8 @@ export const generateCategories = async (writer, { tests, categories, filename =
|
|
|
115
115
|
const nodes = {};
|
|
116
116
|
const roots = [];
|
|
117
117
|
const childrenMap = new Map();
|
|
118
|
-
const categoryOrder = categories.filter((
|
|
119
|
-
const
|
|
118
|
+
const categoryOrder = categories.filter((category) => !category.hide).map((category) => category.id);
|
|
119
|
+
const categoryNodeIds = new Map();
|
|
120
120
|
const categoryTouched = new Set();
|
|
121
121
|
const duplicateChecker = (node) => {
|
|
122
122
|
var _a;
|
|
@@ -134,9 +134,9 @@ export const generateCategories = async (writer, { tests, categories, filename =
|
|
|
134
134
|
incrementStatistic(node.statistic, status);
|
|
135
135
|
};
|
|
136
136
|
const ensureCategoryNode = (category) => {
|
|
137
|
-
const catId =
|
|
138
|
-
if (!
|
|
139
|
-
|
|
137
|
+
const catId = categoryNodeIds.get(category.id) ?? `cat:${md5(category.id)}`;
|
|
138
|
+
if (!categoryNodeIds.has(category.id)) {
|
|
139
|
+
categoryNodeIds.set(category.id, catId);
|
|
140
140
|
}
|
|
141
141
|
duplicateChecker({
|
|
142
142
|
id: catId,
|
|
@@ -155,7 +155,7 @@ export const generateCategories = async (writer, { tests, categories, filename =
|
|
|
155
155
|
continue;
|
|
156
156
|
}
|
|
157
157
|
const catId = ensureCategoryNode(matchedCategory);
|
|
158
|
-
categoryTouched.add(matchedCategory.
|
|
158
|
+
categoryTouched.add(matchedCategory.id);
|
|
159
159
|
bumpStat(catId, tr.status);
|
|
160
160
|
const environmentValue = envKey(tr.environment);
|
|
161
161
|
const isSingleEnvironmentSelected = selectedEnvironmentCount === 1;
|
|
@@ -180,6 +180,12 @@ export const generateCategories = async (writer, { tests, categories, filename =
|
|
|
180
180
|
attachChild(parentId, levelId);
|
|
181
181
|
parentId = levelId;
|
|
182
182
|
}
|
|
183
|
+
tr.categories = [
|
|
184
|
+
{
|
|
185
|
+
name: matchedCategory.name,
|
|
186
|
+
grouping: levels.map((l) => ({ key: l.key, value: l.value, name: l.name })),
|
|
187
|
+
},
|
|
188
|
+
];
|
|
183
189
|
duplicateChecker({
|
|
184
190
|
id: tr.id,
|
|
185
191
|
type: "tr",
|
|
@@ -199,11 +205,11 @@ export const generateCategories = async (writer, { tests, categories, filename =
|
|
|
199
205
|
const sortedChildIds = Array.from(childNodeIds).sort((leftChildId, rightChildId) => compareChildNodes(leftChildId, rightChildId, nodes, environmentOrderMap));
|
|
200
206
|
nodes[parentNodeId].childrenIds = sortedChildIds;
|
|
201
207
|
}
|
|
202
|
-
for (const
|
|
203
|
-
if (!categoryTouched.has(
|
|
208
|
+
for (const categoryId of categoryOrder) {
|
|
209
|
+
if (!categoryTouched.has(categoryId)) {
|
|
204
210
|
continue;
|
|
205
211
|
}
|
|
206
|
-
const id =
|
|
212
|
+
const id = categoryNodeIds.get(categoryId);
|
|
207
213
|
if (id) {
|
|
208
214
|
roots.push(id);
|
|
209
215
|
}
|
package/dist/converters.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type TestFixtureResult, type TestResult, type TestStepResult } from "@allurereport/core-api";
|
|
2
2
|
import type { AwesomeFixtureResult, AwesomeTestResult, AwesomeTestStepResult } from "@allurereport/web-awesome";
|
|
3
|
-
export declare const convertTestResult: (tr: TestResult
|
|
3
|
+
export declare const convertTestResult: (tr: TestResult, options?: {
|
|
4
|
+
hideLabels?: readonly (string | RegExp)[];
|
|
5
|
+
}) => AwesomeTestResult;
|
|
4
6
|
export declare const convertTestStepResult: (tsr: TestStepResult) => AwesomeTestStepResult;
|
|
5
7
|
export declare const convertFixtureResult: (fr: TestFixtureResult) => AwesomeFixtureResult;
|
package/dist/converters.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDictionary, } from "@allurereport/core-api";
|
|
1
|
+
import { createDictionary, shouldHideLabel, } from "@allurereport/core-api";
|
|
2
2
|
import MarkdownIt from "markdown-it";
|
|
3
3
|
const md = new MarkdownIt();
|
|
4
4
|
const markdownToHtml = (value) => (value ? md.render(value) : undefined);
|
|
@@ -11,7 +11,8 @@ const mapLabelsByName = (labels) => {
|
|
|
11
11
|
return acc;
|
|
12
12
|
}, createDictionary());
|
|
13
13
|
};
|
|
14
|
-
export const convertTestResult = (tr) => {
|
|
14
|
+
export const convertTestResult = (tr, options = {}) => {
|
|
15
|
+
const labels = tr.labels.filter(({ name }) => !shouldHideLabel(name, options.hideLabels));
|
|
15
16
|
return {
|
|
16
17
|
id: tr.id,
|
|
17
18
|
name: tr.name,
|
|
@@ -25,8 +26,8 @@ export const convertTestResult = (tr) => {
|
|
|
25
26
|
muted: tr.muted,
|
|
26
27
|
known: tr.known,
|
|
27
28
|
hidden: tr.hidden,
|
|
28
|
-
labels
|
|
29
|
-
groupedLabels: mapLabelsByName(
|
|
29
|
+
labels,
|
|
30
|
+
groupedLabels: mapLabelsByName(labels),
|
|
30
31
|
parameters: tr.parameters,
|
|
31
32
|
links: tr.links,
|
|
32
33
|
steps: tr.steps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { AwesomeOptions } from "./model.js";
|
|
3
3
|
type Writer = {
|
|
4
4
|
writeWidget(fileName: string, data: any): Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export declare const generateTimeline: (writer: Writer, trs:
|
|
6
|
+
export declare const generateTimeline: (writer: Writer, trs: TestResult[], options: AwesomeOptions, environmentIdByTrId: Map<string, string>) => Promise<void>;
|
|
7
7
|
export {};
|
package/dist/generateTimeline.js
CHANGED
|
@@ -2,7 +2,7 @@ const DEFAULT_MIN_DURATION = 1;
|
|
|
2
2
|
const DEFAULT_TIMELINE_OPTIONS = {
|
|
3
3
|
minDuration: DEFAULT_MIN_DURATION,
|
|
4
4
|
};
|
|
5
|
-
export const generateTimeline = async (writer, trs, options) => {
|
|
5
|
+
export const generateTimeline = async (writer, trs, options, environmentIdByTrId) => {
|
|
6
6
|
const { timeline = DEFAULT_TIMELINE_OPTIONS } = options;
|
|
7
7
|
const { minDuration = DEFAULT_MIN_DURATION } = timeline;
|
|
8
8
|
const result = [];
|
|
@@ -16,7 +16,8 @@ export const generateTimeline = async (writer, trs, options) => {
|
|
|
16
16
|
if (duration < minDuration) {
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
const {
|
|
19
|
+
const host = test.labels?.find(({ name }) => name === "host")?.value;
|
|
20
|
+
const thread = test.labels?.find(({ name }) => name === "thread")?.value;
|
|
20
21
|
if (!host?.length || !thread?.length) {
|
|
21
22
|
continue;
|
|
22
23
|
}
|
|
@@ -26,9 +27,10 @@ export const generateTimeline = async (writer, trs, options) => {
|
|
|
26
27
|
name: test.name,
|
|
27
28
|
status: test.status,
|
|
28
29
|
hidden: test.hidden,
|
|
29
|
-
host
|
|
30
|
-
thread
|
|
31
|
-
environment: test.environment,
|
|
30
|
+
host,
|
|
31
|
+
thread,
|
|
32
|
+
environment: environmentIdByTrId.get(test.id) ?? test.environment,
|
|
33
|
+
environmentName: test.environment,
|
|
32
34
|
start: test.start,
|
|
33
35
|
duration,
|
|
34
36
|
});
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type AttachmentLink, type EnvironmentItem, type Statistic, type TestEnvGroup, type TestError, type TestResult } from "@allurereport/core-api";
|
|
1
|
+
import { type AttachmentLink, type EnvironmentIdentity, type EnvironmentItem, type Statistic, type TestEnvGroup, type TestError, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { AllureStore, ExitCode, PluginContext, QualityGateValidationResult, ReportFiles, ResultFile } from "@allurereport/plugin-api";
|
|
3
3
|
import type { AwesomeTestResult } from "@allurereport/web-awesome";
|
|
4
4
|
import type { AwesomeOptions, TemplateManifest } from "./model.js";
|
|
5
5
|
import type { AwesomeDataWriter, ReportFile } from "./writer.js";
|
|
6
6
|
export declare const readTemplateManifest: (singleFileMode?: boolean) => Promise<TemplateManifest>;
|
|
7
|
-
export declare const generateTestResults: (writer: AwesomeDataWriter, store: AllureStore, trs: TestResult[]
|
|
7
|
+
export declare const generateTestResults: (writer: AwesomeDataWriter, store: AllureStore, trs: TestResult[], options?: {
|
|
8
|
+
hideLabels?: readonly (string | RegExp)[];
|
|
9
|
+
}) => Promise<AwesomeTestResult[]>;
|
|
8
10
|
export declare const generateTestCases: (writer: AwesomeDataWriter, trs: AwesomeTestResult[]) => Promise<void>;
|
|
9
11
|
export declare const generateTestEnvGroups: (writer: AwesomeDataWriter, groups: TestEnvGroup[]) => Promise<void>;
|
|
10
12
|
export declare const generateNav: (writer: AwesomeDataWriter, trs: AwesomeTestResult[], filename?: string) => Promise<void>;
|
|
@@ -17,7 +19,7 @@ export declare const generateVariables: (writer: AwesomeDataWriter, store: Allur
|
|
|
17
19
|
export declare const generateStatistic: (writer: AwesomeDataWriter, data: {
|
|
18
20
|
stats: Statistic;
|
|
19
21
|
statsByEnv: Map<string, Statistic>;
|
|
20
|
-
envs:
|
|
22
|
+
envs: EnvironmentIdentity[];
|
|
21
23
|
}) => Promise<void>;
|
|
22
24
|
export declare const generateAttachmentsFiles: (writer: AwesomeDataWriter, attachmentLinks: AttachmentLink[], contentFunction: (id: string) => Promise<ResultFile | undefined>) => Promise<Map<string, string> | undefined>;
|
|
23
25
|
export declare const generateHistoryDataPoints: (writer: AwesomeDataWriter, store: AllureStore) => Promise<Map<string, string>>;
|
package/dist/generators.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defaultChartsConfig } from "@allurereport/charts-api";
|
|
2
|
-
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
3
|
-
import { createTreeByLabels, createTreeByLabelsAndTitlePath, createTreeByTitlePath, filterTree, preciseTreeLabels, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
4
|
-
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
5
|
-
import Handlebars from "handlebars";
|
|
6
1
|
import { randomUUID } from "node:crypto";
|
|
7
2
|
import { readFile } from "node:fs/promises";
|
|
8
3
|
import { createRequire } from "node:module";
|
|
9
4
|
import { basename, join } from "node:path";
|
|
5
|
+
import { defaultChartsConfig } from "@allurereport/charts-api";
|
|
6
|
+
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, incrementStatistic, joinPosixPath, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
7
|
+
import { createTreeByLabels, createTreeByLabelsAndTitlePath, createTreeByTitlePath, filterTree, preciseTreeLabels, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
8
|
+
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
9
|
+
import Handlebars from "handlebars";
|
|
10
10
|
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
12
|
const template = `<!DOCTYPE html>
|
|
@@ -73,12 +73,12 @@ const createBreadcrumbs = (convertedTr) => {
|
|
|
73
73
|
return acc;
|
|
74
74
|
}, []);
|
|
75
75
|
};
|
|
76
|
-
export const generateTestResults = async (writer, store, trs) => {
|
|
76
|
+
export const generateTestResults = async (writer, store, trs, options = {}) => {
|
|
77
77
|
let convertedTrs = [];
|
|
78
78
|
for (const tr of trs) {
|
|
79
79
|
const trFixtures = await store.fixturesByTrId(tr.id);
|
|
80
80
|
const convertedTrFixtures = trFixtures.map(convertFixtureResult);
|
|
81
|
-
const convertedTr = convertTestResult(tr);
|
|
81
|
+
const convertedTr = convertTestResult(tr, { hideLabels: options.hideLabels });
|
|
82
82
|
convertedTr.history = (await store.historyByTrId(tr.id)) ?? [];
|
|
83
83
|
convertedTr.retries = await store.retriesByTrId(tr.id);
|
|
84
84
|
convertedTr.retriesCount = convertedTr.retries.length;
|
|
@@ -108,7 +108,7 @@ export const generateTestCases = async (writer, trs) => {
|
|
|
108
108
|
};
|
|
109
109
|
export const generateTestEnvGroups = async (writer, groups) => {
|
|
110
110
|
for (const group of groups) {
|
|
111
|
-
const src =
|
|
111
|
+
const src = joinPosixPath("test-env-groups", `${group.id}.json`);
|
|
112
112
|
await writer.writeData(src, group);
|
|
113
113
|
}
|
|
114
114
|
};
|
|
@@ -215,16 +215,16 @@ export const generateEnvironmentJson = async (writer, env) => {
|
|
|
215
215
|
await writer.writeWidget("allure_environment.json", env);
|
|
216
216
|
};
|
|
217
217
|
export const generateEnvirontmentsList = async (writer, store) => {
|
|
218
|
-
const environments = await store.
|
|
218
|
+
const environments = await store.allEnvironmentIdentities();
|
|
219
219
|
await writer.writeWidget("environments.json", environments);
|
|
220
220
|
};
|
|
221
221
|
export const generateVariables = async (writer, store) => {
|
|
222
222
|
const reportVariables = await store.allVariables();
|
|
223
|
-
const environments = await store.
|
|
223
|
+
const environments = await store.allEnvironmentIdentities();
|
|
224
224
|
await writer.writeWidget("variables.json", reportVariables);
|
|
225
225
|
for (const env of environments) {
|
|
226
|
-
const envVariables = await store.
|
|
227
|
-
await writer.writeWidget(
|
|
226
|
+
const envVariables = await store.envVariablesByEnvironmentId(env.id);
|
|
227
|
+
await writer.writeWidget(joinPosixPath(env.id, "variables.json"), envVariables);
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
export const generateStatistic = async (writer, data) => {
|
|
@@ -232,12 +232,12 @@ export const generateStatistic = async (writer, data) => {
|
|
|
232
232
|
await writer.writeWidget("statistic.json", stats);
|
|
233
233
|
await writer.writeWidget("pie_chart.json", getPieChartValues(stats));
|
|
234
234
|
for (const env of envs) {
|
|
235
|
-
const envStats = statsByEnv.get(env);
|
|
235
|
+
const envStats = statsByEnv.get(env.id);
|
|
236
236
|
if (!envStats) {
|
|
237
237
|
continue;
|
|
238
238
|
}
|
|
239
|
-
await writer.writeWidget(
|
|
240
|
-
await writer.writeWidget(
|
|
239
|
+
await writer.writeWidget(joinPosixPath(env.id, "statistic.json"), envStats);
|
|
240
|
+
await writer.writeWidget(joinPosixPath(env.id, "pie_chart.json"), envStats);
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
export const generateAttachmentsFiles = async (writer, attachmentLinks, contentFunction) => {
|
|
@@ -343,7 +343,7 @@ export const generateStaticFiles = async (payload) => {
|
|
|
343
343
|
headTags: headTags.join("\n"),
|
|
344
344
|
bodyTags: bodyTags.join("\n"),
|
|
345
345
|
reportFilesScript: createReportDataScript(reportDataFiles),
|
|
346
|
-
reportOptions:
|
|
346
|
+
reportOptions: stringifyForInlineScript(reportOptions),
|
|
347
347
|
analyticsEnable: true,
|
|
348
348
|
allureVersion,
|
|
349
349
|
reportUuid,
|
package/dist/plugin.js
CHANGED
|
@@ -10,54 +10,89 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _AwesomePlugin_writer, _AwesomePlugin_generate;
|
|
13
|
+
import { incrementStatistic, joinPosixPath } from "@allurereport/core-api";
|
|
13
14
|
import { createPluginSummary, } from "@allurereport/plugin-api";
|
|
14
15
|
import { preciseTreeLabels } from "@allurereport/plugin-api";
|
|
15
|
-
import { join } from "node:path";
|
|
16
16
|
import { applyCategoriesToTestResults, generateCategories } from "./categories.js";
|
|
17
|
-
import { filterEnv } from "./environments.js";
|
|
18
17
|
import { generateTimeline } from "./generateTimeline.js";
|
|
19
18
|
import { generateAllCharts, generateAttachmentsFiles, generateEnvironmentJson, generateEnvirontmentsList, generateGlobals, generateHistoryDataPoints, generateNav, generateQualityGateResults, generateStaticFiles, generateStatistic, generateTestCases, generateTestEnvGroups, generateTestResults, generateTree, generateTreeFilters, generateVariables, } from "./generators.js";
|
|
20
19
|
import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
|
|
20
|
+
const statisticByTestResults = async (store, testResults) => {
|
|
21
|
+
const statistic = { total: 0 };
|
|
22
|
+
for (const testResult of testResults) {
|
|
23
|
+
if (testResult.hidden) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
statistic.total++;
|
|
27
|
+
incrementStatistic(statistic, testResult.status);
|
|
28
|
+
if ((await store.retriesByTrId(testResult.id)).length > 0) {
|
|
29
|
+
statistic.retries = (statistic.retries ?? 0) + 1;
|
|
30
|
+
}
|
|
31
|
+
if (testResult.flaky) {
|
|
32
|
+
statistic.flaky = (statistic.flaky ?? 0) + 1;
|
|
33
|
+
}
|
|
34
|
+
if (testResult.transition === "new") {
|
|
35
|
+
statistic.new = (statistic.new ?? 0) + 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return statistic;
|
|
39
|
+
};
|
|
21
40
|
export class AwesomePlugin {
|
|
22
41
|
constructor(options = {}) {
|
|
23
42
|
this.options = options;
|
|
24
43
|
_AwesomePlugin_writer.set(this, void 0);
|
|
25
44
|
_AwesomePlugin_generate.set(this, async (context, store) => {
|
|
26
45
|
const { singleFile, groupBy = [], filter, appendTitlePath } = this.options ?? {};
|
|
46
|
+
const hideLabels = context.hideLabels;
|
|
27
47
|
const categories = context.categories ?? [];
|
|
28
48
|
const environmentItems = await store.metadataByKey("allure_environment");
|
|
29
|
-
const reportEnvironments = await store.allEnvironments();
|
|
30
49
|
const attachments = await store.allAttachments();
|
|
31
50
|
const allTrs = await store.allTestResults({ includeHidden: true, filter });
|
|
32
51
|
const statistics = await store.testsStatistic(filter);
|
|
33
|
-
const environments = await store.
|
|
52
|
+
const environments = await store.allEnvironmentIdentities();
|
|
34
53
|
const envStatistics = new Map();
|
|
35
54
|
const allTestEnvGroups = await store.allTestEnvGroups();
|
|
36
55
|
const globalAttachments = await store.allGlobalAttachments();
|
|
37
56
|
const globalExitCode = await store.globalExitCode();
|
|
38
57
|
const globalErrors = await store.allGlobalErrors();
|
|
39
|
-
const qualityGateResults = await store.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
58
|
+
const qualityGateResults = await store.qualityGateResultsByEnvironmentId();
|
|
59
|
+
const envResultsById = new Map();
|
|
60
|
+
const envIdByTrId = new Map();
|
|
61
|
+
environments.forEach(({ id }) => {
|
|
62
|
+
envResultsById.set(id, []);
|
|
63
|
+
});
|
|
64
|
+
await Promise.all(allTrs.map(async (tr) => {
|
|
65
|
+
const environmentId = await store.environmentIdByTrId(tr.id);
|
|
66
|
+
if (!environmentId) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
envIdByTrId.set(tr.id, environmentId);
|
|
70
|
+
if (!envResultsById.has(environmentId)) {
|
|
71
|
+
envResultsById.set(environmentId, []);
|
|
72
|
+
}
|
|
73
|
+
envResultsById.get(environmentId).push(tr);
|
|
74
|
+
}));
|
|
75
|
+
await Promise.all(environments.map(async ({ id }) => {
|
|
76
|
+
envStatistics.set(id, await statisticByTestResults(store, envResultsById.get(id) ?? []));
|
|
77
|
+
}));
|
|
43
78
|
await generateStatistic(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
44
79
|
stats: statistics,
|
|
45
80
|
statsByEnv: envStatistics,
|
|
46
81
|
envs: environments,
|
|
47
82
|
});
|
|
48
83
|
await generateAllCharts(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options, context);
|
|
49
|
-
const convertedTrs = await generateTestResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, allTrs);
|
|
84
|
+
const convertedTrs = await generateTestResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, allTrs, { hideLabels });
|
|
50
85
|
applyCategoriesToTestResults(convertedTrs, categories);
|
|
51
86
|
await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
52
87
|
tests: convertedTrs,
|
|
53
88
|
categories,
|
|
54
89
|
environmentCount: environments.length,
|
|
55
|
-
environments,
|
|
90
|
+
environments: environments.map(({ name }) => name),
|
|
56
91
|
defaultEnvironment: "default",
|
|
57
92
|
selectedEnvironmentCount: environments.length,
|
|
58
93
|
});
|
|
59
94
|
const hasGroupBy = groupBy.length > 0;
|
|
60
|
-
await generateTimeline(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"),
|
|
95
|
+
await generateTimeline(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTrs, this.options, envIdByTrId);
|
|
61
96
|
const treeLabels = hasGroupBy
|
|
62
97
|
? preciseTreeLabels(groupBy, convertedTrs, ({ labels }) => labels.map(({ name }) => name))
|
|
63
98
|
: [];
|
|
@@ -66,19 +101,30 @@ export class AwesomePlugin {
|
|
|
66
101
|
await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), "tree.json", treeLabels, convertedTrs, { appendTitlePath });
|
|
67
102
|
await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs, "nav.json");
|
|
68
103
|
await generateTestEnvGroups(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), allTestEnvGroups);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
104
|
+
const envConvertedTrsById = new Map();
|
|
105
|
+
convertedTrs.forEach((tr) => {
|
|
106
|
+
const environmentId = envIdByTrId.get(tr.id);
|
|
107
|
+
if (!environmentId) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!envConvertedTrsById.has(environmentId)) {
|
|
111
|
+
envConvertedTrsById.set(environmentId, []);
|
|
112
|
+
}
|
|
113
|
+
envConvertedTrsById.get(environmentId).push(tr);
|
|
114
|
+
});
|
|
115
|
+
for (const reportEnvironment of environments) {
|
|
116
|
+
const envConvertedTrs = envConvertedTrsById.get(reportEnvironment.id) ?? [];
|
|
117
|
+
await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), joinPosixPath(reportEnvironment.id, "tree.json"), treeLabels, envConvertedTrs, {
|
|
72
118
|
appendTitlePath,
|
|
73
119
|
});
|
|
74
|
-
await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs,
|
|
120
|
+
await generateNav(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), envConvertedTrs, joinPosixPath(reportEnvironment.id, "nav.json"));
|
|
75
121
|
await generateCategories(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
76
122
|
tests: envConvertedTrs,
|
|
77
123
|
categories,
|
|
78
124
|
environmentCount: 1,
|
|
79
125
|
defaultEnvironment: "default",
|
|
80
126
|
selectedEnvironmentCount: 1,
|
|
81
|
-
filename:
|
|
127
|
+
filename: joinPosixPath(reportEnvironment.id, "categories.json"),
|
|
82
128
|
});
|
|
83
129
|
}
|
|
84
130
|
await generateTreeFilters(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
|
package/dist/writer.js
CHANGED
|
@@ -6,7 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _InMemoryReportDataWriter_data;
|
|
7
7
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
8
8
|
import { resolve } from "node:path";
|
|
9
|
-
import {
|
|
9
|
+
import { joinPosixPath } from "@allurereport/core-api";
|
|
10
10
|
export class FileSystemReportDataWriter {
|
|
11
11
|
constructor(output) {
|
|
12
12
|
this.output = output;
|
|
@@ -37,19 +37,19 @@ export class InMemoryReportDataWriter {
|
|
|
37
37
|
_InMemoryReportDataWriter_data.set(this, {});
|
|
38
38
|
}
|
|
39
39
|
async writeData(fileName, data) {
|
|
40
|
-
const dist =
|
|
40
|
+
const dist = joinPosixPath("data", fileName);
|
|
41
41
|
__classPrivateFieldGet(this, _InMemoryReportDataWriter_data, "f")[dist] = Buffer.from(JSON.stringify(data), "utf-8");
|
|
42
42
|
}
|
|
43
43
|
async writeWidget(fileName, data) {
|
|
44
|
-
const dist =
|
|
44
|
+
const dist = joinPosixPath("widgets", fileName);
|
|
45
45
|
__classPrivateFieldGet(this, _InMemoryReportDataWriter_data, "f")[dist] = Buffer.from(JSON.stringify(data), "utf-8");
|
|
46
46
|
}
|
|
47
47
|
async writeTestCase(test) {
|
|
48
|
-
const dist =
|
|
48
|
+
const dist = joinPosixPath("data", "test-results", `${test.id}.json`);
|
|
49
49
|
__classPrivateFieldGet(this, _InMemoryReportDataWriter_data, "f")[dist] = Buffer.from(JSON.stringify(test), "utf-8");
|
|
50
50
|
}
|
|
51
51
|
async writeAttachment(fileName, file) {
|
|
52
|
-
const dist =
|
|
52
|
+
const dist = joinPosixPath("data", "attachments", fileName);
|
|
53
53
|
const content = await file.asBuffer();
|
|
54
54
|
if (content) {
|
|
55
55
|
__classPrivateFieldGet(this, _InMemoryReportDataWriter_data, "f")[dist] = content;
|
|
@@ -68,19 +68,19 @@ export class ReportFileDataWriter {
|
|
|
68
68
|
this.reportFiles = reportFiles;
|
|
69
69
|
}
|
|
70
70
|
async writeData(fileName, data) {
|
|
71
|
-
await this.reportFiles.addFile(
|
|
71
|
+
await this.reportFiles.addFile(joinPosixPath("data", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
|
|
72
72
|
}
|
|
73
73
|
async writeWidget(fileName, data) {
|
|
74
|
-
await this.reportFiles.addFile(
|
|
74
|
+
await this.reportFiles.addFile(joinPosixPath("widgets", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
|
|
75
75
|
}
|
|
76
76
|
async writeAttachment(source, file) {
|
|
77
77
|
const contentBuffer = await file.asBuffer();
|
|
78
78
|
if (!contentBuffer) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
await this.reportFiles.addFile(
|
|
81
|
+
await this.reportFiles.addFile(joinPosixPath("data", "attachments", source), contentBuffer);
|
|
82
82
|
}
|
|
83
83
|
async writeTestCase(test) {
|
|
84
|
-
await this.reportFiles.addFile(
|
|
84
|
+
await this.reportFiles.addFile(joinPosixPath("data", "test-results", `${test.id}.json`), Buffer.from(JSON.stringify(test), "utf8"));
|
|
85
85
|
}
|
|
86
86
|
}
|
package/package.json
CHANGED
|
@@ -1,61 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-awesome",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
7
|
-
"
|
|
8
|
-
"report",
|
|
7
|
+
"html",
|
|
9
8
|
"plugin",
|
|
10
|
-
"
|
|
9
|
+
"report",
|
|
10
|
+
"testing"
|
|
11
11
|
],
|
|
12
|
-
"repository": "https://github.com/allure-framework/allure3",
|
|
13
12
|
"license": "Apache-2.0",
|
|
14
13
|
"author": "Qameta Software",
|
|
14
|
+
"repository": "https://github.com/allure-framework/allure3",
|
|
15
|
+
"files": [
|
|
16
|
+
"./dist"
|
|
17
|
+
],
|
|
15
18
|
"type": "module",
|
|
16
|
-
"exports": {
|
|
17
|
-
".": "./dist/index.js"
|
|
18
|
-
},
|
|
19
19
|
"main": "./dist/index.js",
|
|
20
20
|
"module": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
|
-
"
|
|
23
|
-
"./dist"
|
|
24
|
-
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./dist/index.js"
|
|
24
|
+
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
27
27
|
"clean": "rimraf ./dist",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"test": "rimraf ./out && vitest run",
|
|
29
|
+
"lint": "oxlint --import-plugin src test features stories",
|
|
30
|
+
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/charts-api": "3.
|
|
34
|
-
"@allurereport/core-api": "3.
|
|
35
|
-
"@allurereport/plugin-api": "3.
|
|
36
|
-
"@allurereport/web-awesome": "3.
|
|
37
|
-
"@allurereport/web-commons": "3.
|
|
33
|
+
"@allurereport/charts-api": "3.4.1",
|
|
34
|
+
"@allurereport/core-api": "3.4.1",
|
|
35
|
+
"@allurereport/plugin-api": "3.4.1",
|
|
36
|
+
"@allurereport/web-awesome": "3.4.1",
|
|
37
|
+
"@allurereport/web-commons": "3.4.1",
|
|
38
38
|
"d3-shape": "^3.2.0",
|
|
39
|
-
"handlebars": "^4.7.
|
|
39
|
+
"handlebars": "^4.7.9",
|
|
40
40
|
"markdown-it": "^14.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@stylistic/eslint-plugin": "^2.6.1",
|
|
44
43
|
"@types/d3-shape": "^3.1.6",
|
|
45
|
-
"@types/eslint": "^8.56.11",
|
|
46
44
|
"@types/markdown-it": "^14.1.2",
|
|
47
45
|
"@types/node": "^20.17.9",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
49
|
-
"@typescript-eslint/parser": "^8.0.0",
|
|
50
46
|
"@vitest/runner": "^2.1.9",
|
|
51
47
|
"allure-vitest": "^3.3.3",
|
|
52
|
-
"eslint": "^8.57.0",
|
|
53
|
-
"eslint-config-prettier": "^9.1.0",
|
|
54
|
-
"eslint-plugin-import": "^2.29.1",
|
|
55
|
-
"eslint-plugin-jsdoc": "^50.0.0",
|
|
56
|
-
"eslint-plugin-n": "^17.10.1",
|
|
57
|
-
"eslint-plugin-no-null": "^1.0.2",
|
|
58
|
-
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
59
48
|
"rimraf": "^6.0.1",
|
|
60
49
|
"typescript": "^5.6.3",
|
|
61
50
|
"vitest": "^2.1.9"
|
package/dist/environments.d.ts
DELETED