@allurereport/plugin-awesome 3.0.0-beta.20 → 3.0.0-beta.21
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.d.ts +3 -1
- package/dist/generators.js +16 -2
- package/dist/model.d.ts +1 -1
- package/dist/plugin.js +4 -3
- package/package.json +6 -4
- package/dist/charts.d.ts +0 -5
- package/dist/charts.js +0 -51
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AttachmentLink, type EnvironmentItem, type Statistic, type TestEnvGroup, type TestError, type TestResult } from "@allurereport/core-api";
|
|
2
|
-
import {
|
|
2
|
+
import type { AllureStore, ExitCode, PluginContext, QualityGateValidationResult, ReportFiles, ResultFile, TestResultFilter } 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";
|
|
@@ -25,6 +25,7 @@ export declare const generateGlobals: (writer: AwesomeDataWriter, payload: {
|
|
|
25
25
|
globalErrors?: TestError[];
|
|
26
26
|
contentFunction: (id: string) => Promise<ResultFile | undefined>;
|
|
27
27
|
}) => Promise<void>;
|
|
28
|
+
export declare const generateQualityGateResults: (writer: AwesomeDataWriter, qualityGateResults?: QualityGateValidationResult[]) => Promise<void>;
|
|
28
29
|
export declare const generateStaticFiles: (payload: AwesomeOptions & {
|
|
29
30
|
id: string;
|
|
30
31
|
allureVersion: string;
|
|
@@ -33,3 +34,4 @@ export declare const generateStaticFiles: (payload: AwesomeOptions & {
|
|
|
33
34
|
reportUuid: string;
|
|
34
35
|
reportName: string;
|
|
35
36
|
}) => Promise<void>;
|
|
37
|
+
export declare const generateAllCharts: (writer: AwesomeDataWriter, store: AllureStore, options: AwesomeOptions, context: PluginContext) => Promise<void>;
|
package/dist/generators.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag,
|
|
1
|
+
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
2
2
|
import { createTreeByLabels, createTreeByTitlePath, filterTree, preciseTreeLabels, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
3
|
+
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
3
4
|
import Handlebars from "handlebars";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
4
6
|
import { readFile } from "node:fs/promises";
|
|
5
7
|
import { createRequire } from "node:module";
|
|
6
8
|
import { basename, join } from "node:path";
|
|
@@ -236,6 +238,9 @@ export const generateGlobals = async (writer, payload) => {
|
|
|
236
238
|
}
|
|
237
239
|
await writer.writeWidget("globals.json", globals);
|
|
238
240
|
};
|
|
241
|
+
export const generateQualityGateResults = async (writer, qualityGateResults = []) => {
|
|
242
|
+
await writer.writeWidget("quality-gate.json", qualityGateResults);
|
|
243
|
+
};
|
|
239
244
|
export const generateStaticFiles = async (payload) => {
|
|
240
245
|
const { id, reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "light", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, layout = "base", charts = [], defaultSection = "", ci, } = payload;
|
|
241
246
|
const compile = Handlebars.compile(template);
|
|
@@ -307,8 +312,17 @@ export const generateStaticFiles = async (payload) => {
|
|
|
307
312
|
if (err instanceof RangeError) {
|
|
308
313
|
console.error("The report is too large to be generated in the single file mode!");
|
|
309
314
|
process.exit(1);
|
|
310
|
-
return;
|
|
311
315
|
}
|
|
312
316
|
throw err;
|
|
313
317
|
}
|
|
314
318
|
};
|
|
319
|
+
export const generateAllCharts = async (writer, store, options, context) => {
|
|
320
|
+
const { charts } = options;
|
|
321
|
+
if (!charts) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const generatedChartsData = await generateCharts(charts, store, context.reportName, randomUUID);
|
|
325
|
+
if (Object.keys(generatedChartsData.general).length > 0) {
|
|
326
|
+
await writer.writeWidget("charts.json", generatedChartsData);
|
|
327
|
+
}
|
|
328
|
+
};
|
package/dist/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ChartOptions } from "@allurereport/charts-api";
|
|
1
2
|
import type { CiDescriptor, EnvironmentsConfig, TestResult } from "@allurereport/core-api";
|
|
2
|
-
import type { ChartOptions } from "@allurereport/plugin-api";
|
|
3
3
|
export type AwesomeOptions = {
|
|
4
4
|
reportName?: string;
|
|
5
5
|
singleFile?: boolean;
|
package/dist/plugin.js
CHANGED
|
@@ -14,9 +14,8 @@ import { getWorstStatus } from "@allurereport/core-api";
|
|
|
14
14
|
import { convertToSummaryTestResult, } from "@allurereport/plugin-api";
|
|
15
15
|
import { preciseTreeLabels } from "@allurereport/plugin-api";
|
|
16
16
|
import { join } from "node:path";
|
|
17
|
-
import { generateAllCharts } from "./charts.js";
|
|
18
17
|
import { filterEnv } from "./environments.js";
|
|
19
|
-
import { generateAttachmentsFiles, generateEnvironmentJson, generateEnvirontmentsList, generateGlobals, generateHistoryDataPoints, generateNav, generateStaticFiles, generateStatistic, generateTestCases, generateTestEnvGroups, generateTestResults, generateTree, generateVariables, } from "./generators.js";
|
|
18
|
+
import { generateAllCharts, generateAttachmentsFiles, generateEnvironmentJson, generateEnvirontmentsList, generateGlobals, generateHistoryDataPoints, generateNav, generateQualityGateResults, generateStaticFiles, generateStatistic, generateTestCases, generateTestEnvGroups, generateTestResults, generateTree, generateVariables, } from "./generators.js";
|
|
20
19
|
import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
|
|
21
20
|
export class AwesomePlugin {
|
|
22
21
|
constructor(options = {}) {
|
|
@@ -35,6 +34,7 @@ export class AwesomePlugin {
|
|
|
35
34
|
const globalAttachments = await store.allGlobalAttachments();
|
|
36
35
|
const globalExitCode = await store.globalExitCode();
|
|
37
36
|
const globalErrors = await store.allGlobalErrors();
|
|
37
|
+
const qualityGateResults = await store.qualityGateResults();
|
|
38
38
|
for (const env of environments) {
|
|
39
39
|
envStatistics.set(env, await store.testsStatistic(filterEnv(env, filter)));
|
|
40
40
|
}
|
|
@@ -67,13 +67,14 @@ export class AwesomePlugin {
|
|
|
67
67
|
if (attachments?.length) {
|
|
68
68
|
await generateAttachmentsFiles(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), attachments, (id) => store.attachmentContentById(id));
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
await generateQualityGateResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), qualityGateResults);
|
|
71
71
|
await generateGlobals(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
72
72
|
globalAttachments,
|
|
73
73
|
globalErrors,
|
|
74
74
|
globalExitCode,
|
|
75
75
|
contentFunction: (id) => store.attachmentContentById(id),
|
|
76
76
|
});
|
|
77
|
+
const reportDataFiles = singleFile ? __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles() : [];
|
|
77
78
|
await generateStaticFiles({
|
|
78
79
|
...this.options,
|
|
79
80
|
id: context.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-awesome",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.21",
|
|
4
4
|
"description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,9 +30,11 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/
|
|
34
|
-
"@allurereport/
|
|
35
|
-
"@allurereport/
|
|
33
|
+
"@allurereport/charts-api": "3.0.0-beta.21",
|
|
34
|
+
"@allurereport/core-api": "3.0.0-beta.21",
|
|
35
|
+
"@allurereport/plugin-api": "3.0.0-beta.21",
|
|
36
|
+
"@allurereport/web-awesome": "3.0.0-beta.21",
|
|
37
|
+
"@allurereport/web-commons": "3.0.0-beta.21",
|
|
36
38
|
"d3-shape": "^3.2.0",
|
|
37
39
|
"handlebars": "^4.7.8"
|
|
38
40
|
},
|
package/dist/charts.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type AllureStore, type GeneratedChartsData, type PluginContext } from "@allurereport/plugin-api";
|
|
2
|
-
import type { AwesomeOptions } from "./model.js";
|
|
3
|
-
import type { AwesomeDataWriter } from "./writer.js";
|
|
4
|
-
export declare const generateCharts: (options: AwesomeOptions, store: AllureStore, context: PluginContext) => Promise<GeneratedChartsData | undefined>;
|
|
5
|
-
export declare const generateAllCharts: (writer: AwesomeDataWriter, store: AllureStore, options: AwesomeOptions, context: PluginContext) => Promise<void>;
|
package/dist/charts.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ChartType } from "@allurereport/core-api";
|
|
2
|
-
import { generateBarChart, generateComingSoonChart, generateHeatMapChart, generatePieChart, generateTreeMapChart, generateTrendChart, } from "@allurereport/plugin-api";
|
|
3
|
-
import { randomUUID } from "crypto";
|
|
4
|
-
export const generateCharts = async (options, store, context) => {
|
|
5
|
-
const { charts } = options;
|
|
6
|
-
if (!charts) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const storeData = await Promise.all([
|
|
10
|
-
store.allHistoryDataPoints(),
|
|
11
|
-
store.allTestResults(),
|
|
12
|
-
store.testsStatistic(),
|
|
13
|
-
]).then(([historyDataPoints, testResults, statistic]) => ({
|
|
14
|
-
historyDataPoints,
|
|
15
|
-
testResults,
|
|
16
|
-
statistic,
|
|
17
|
-
}));
|
|
18
|
-
const chartsData = {};
|
|
19
|
-
for (const chartOptions of charts) {
|
|
20
|
-
const chartId = randomUUID();
|
|
21
|
-
let chart;
|
|
22
|
-
if (chartOptions.type === ChartType.Trend) {
|
|
23
|
-
chart = generateTrendChart(chartOptions, storeData, context);
|
|
24
|
-
}
|
|
25
|
-
else if (chartOptions.type === ChartType.Pie) {
|
|
26
|
-
chart = generatePieChart(chartOptions, storeData);
|
|
27
|
-
}
|
|
28
|
-
else if (chartOptions.type === ChartType.Bar) {
|
|
29
|
-
chart = generateBarChart(chartOptions, storeData);
|
|
30
|
-
}
|
|
31
|
-
else if (chartOptions.type === ChartType.TreeMap) {
|
|
32
|
-
chart = generateTreeMapChart(chartOptions, storeData);
|
|
33
|
-
}
|
|
34
|
-
else if (chartOptions.type === ChartType.HeatMap) {
|
|
35
|
-
chart = generateHeatMapChart(chartOptions, storeData);
|
|
36
|
-
}
|
|
37
|
-
if (chart) {
|
|
38
|
-
chartsData[chartId] = chart;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
chartsData[chartId] = generateComingSoonChart(chartOptions);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return chartsData;
|
|
45
|
-
};
|
|
46
|
-
export const generateAllCharts = async (writer, store, options, context) => {
|
|
47
|
-
const charts = await generateCharts(options, store, context);
|
|
48
|
-
if (charts && Object.keys(charts).length > 0) {
|
|
49
|
-
await writer.writeWidget("charts.json", charts);
|
|
50
|
-
}
|
|
51
|
-
};
|