@allurereport/plugin-classic 3.15.0 → 3.16.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/converters.d.ts +4 -4
- package/dist/converters.js +0 -1
- package/dist/generators.d.ts +6 -6
- package/dist/generators.js +25 -19
- package/dist/plugin.js +2 -1
- package/dist/static/report.tar +0 -0
- package/dist/writer.d.ts +5 -6
- package/package.json +7 -7
package/dist/converters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TestFixtureResult, type TestResult, type TestStepResult } from "@allurereport/core-api";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const convertTestResult: (tr: TestResult) =>
|
|
4
|
-
export declare const convertTestStepResult: (tsr: TestStepResult) =>
|
|
5
|
-
export declare const convertFixtureResult: (fr: TestFixtureResult) =>
|
|
2
|
+
import type { ReportFixtureResult, ReportTestResult, ReportTestStepResult } from "@allurereport/plugin-api";
|
|
3
|
+
export declare const convertTestResult: (tr: TestResult) => ReportTestResult;
|
|
4
|
+
export declare const convertTestStepResult: (tsr: TestStepResult) => ReportTestStepResult;
|
|
5
|
+
export declare const convertFixtureResult: (fr: TestFixtureResult) => ReportFixtureResult;
|
package/dist/converters.js
CHANGED
package/dist/generators.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type AttachmentLink, type EnvironmentItem, type Statistic } from "@allurereport/core-api";
|
|
2
|
-
import { type AllureStore, type ReportFiles, type ResultFile } from "@allurereport/plugin-api";
|
|
3
|
-
import type { ClassicTestResult } from "@allurereport/web-classic";
|
|
2
|
+
import { type AllureStore, type ReportTestResult, type PluginContext, type ReportFiles, type ResultFile } from "@allurereport/plugin-api";
|
|
4
3
|
import type { ClassicOptions, TemplateManifest } from "./model.js";
|
|
5
4
|
import type { ClassicDataWriter, ReportFile } from "./writer.js";
|
|
6
|
-
export declare const readTemplateManifest: (
|
|
7
|
-
export declare const generateTestResults: (writer: ClassicDataWriter, store: AllureStore) => Promise<
|
|
8
|
-
export declare const generateTree: (writer: ClassicDataWriter, treeName: string, labels: string[], tests:
|
|
5
|
+
export declare const readTemplateManifest: (_singleFileMode?: boolean) => Promise<TemplateManifest>;
|
|
6
|
+
export declare const generateTestResults: (writer: ClassicDataWriter, store: AllureStore) => Promise<ReportTestResult[]>;
|
|
7
|
+
export declare const generateTree: (writer: ClassicDataWriter, treeName: string, labels: string[], tests: ReportTestResult[]) => Promise<void>;
|
|
9
8
|
export declare const generateEnvironmentJson: (writer: ClassicDataWriter, env: EnvironmentItem[]) => Promise<void>;
|
|
10
9
|
export declare const generateStatistic: (writer: ClassicDataWriter, statistic: Statistic) => Promise<void>;
|
|
11
10
|
export declare const generatePieChart: (writer: ClassicDataWriter, statistic: Statistic) => Promise<void>;
|
|
11
|
+
export declare const generateAllCharts: (writer: ClassicDataWriter, store: AllureStore, options: ClassicOptions, context: PluginContext) => Promise<void>;
|
|
12
12
|
export declare const generateAttachmentsFiles: (writer: ClassicDataWriter, attachmentLinks: AttachmentLink[], contentFunction: (id: string) => Promise<ResultFile | undefined>) => Promise<Map<string, string>>;
|
|
13
13
|
export declare const generateHistoryDataPoints: (writer: ClassicDataWriter, store: AllureStore) => Promise<Map<string, string>>;
|
|
14
14
|
export declare const generateStaticFiles: (payload: ClassicOptions & {
|
|
@@ -18,4 +18,4 @@ export declare const generateStaticFiles: (payload: ClassicOptions & {
|
|
|
18
18
|
reportUuid: string;
|
|
19
19
|
reportName: string;
|
|
20
20
|
}) => Promise<void>;
|
|
21
|
-
export declare const generateTreeByCategories: (writer: ClassicDataWriter, treeName: string, tests:
|
|
21
|
+
export declare const generateTreeByCategories: (writer: ClassicDataWriter, treeName: string, tests: ReportTestResult[]) => Promise<void>;
|
package/dist/generators.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { basename, join } from "node:path";
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { defaultChartsConfig } from "@allurereport/charts-api";
|
|
4
3
|
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
5
4
|
import { createTreeByCategories, createTreeByLabels, processTree, } from "@allurereport/plugin-api";
|
|
6
|
-
import {
|
|
5
|
+
import { copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
|
|
6
|
+
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
7
7
|
import Handlebars from "handlebars";
|
|
8
8
|
import { matchCategories } from "./categories.js";
|
|
9
9
|
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
10
|
-
const
|
|
10
|
+
const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
|
|
11
11
|
const template = `<!DOCTYPE html>
|
|
12
12
|
<html dir="ltr" lang="en">
|
|
13
13
|
<head>
|
|
@@ -50,10 +50,9 @@ const writeConcurrently = async (items, write, concurrency = 64) => {
|
|
|
50
50
|
await Promise.all(items.slice(i, i + concurrency).map(write));
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
export const readTemplateManifest = async (
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
return JSON.parse(templateManifest);
|
|
53
|
+
export const readTemplateManifest = async (_singleFileMode) => {
|
|
54
|
+
const { manifest } = await readReportStaticAssets(reportStaticArchive);
|
|
55
|
+
return manifest;
|
|
57
56
|
};
|
|
58
57
|
const createBreadcrumbs = (convertedTr) => {
|
|
59
58
|
const labelsByType = convertedTr.labels.reduce((acc, label) => {
|
|
@@ -152,6 +151,13 @@ export const generatePieChart = async (writer, statistic) => {
|
|
|
152
151
|
const chartData = getPieChartValues(statistic);
|
|
153
152
|
await writer.writeWidget("allure_pie_chart.json", chartData);
|
|
154
153
|
};
|
|
154
|
+
export const generateAllCharts = async (writer, store, options, context) => {
|
|
155
|
+
const { filter } = options;
|
|
156
|
+
const generatedChartsData = await generateCharts(defaultChartsConfig, store, context.reportName, randomUUID, filter);
|
|
157
|
+
if (Object.keys(generatedChartsData.general).length > 0) {
|
|
158
|
+
await writer.writeWidget("charts.json", generatedChartsData);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
155
161
|
export const generateAttachmentsFiles = async (writer, attachmentLinks, contentFunction) => {
|
|
156
162
|
const result = new Map();
|
|
157
163
|
for (const { id, ext, ...link } of attachmentLinks) {
|
|
@@ -178,14 +184,14 @@ export const generateHistoryDataPoints = async (writer, store) => {
|
|
|
178
184
|
return result;
|
|
179
185
|
};
|
|
180
186
|
export const generateStaticFiles = async (payload) => {
|
|
181
|
-
const { reportName = "Allure Report", reportLanguage = "en",
|
|
182
|
-
const
|
|
187
|
+
const { reportName = "Allure Report", reportLanguage = "en", logo = "", theme = "auto", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, } = payload;
|
|
188
|
+
const staticAssets = await readReportStaticAssets(reportStaticArchive);
|
|
189
|
+
const { manifest } = staticAssets;
|
|
183
190
|
const headTags = [];
|
|
184
191
|
const bodyTags = [];
|
|
185
192
|
if (!payload.singleFile) {
|
|
186
193
|
for (const key in manifest) {
|
|
187
194
|
const fileName = manifest[key];
|
|
188
|
-
const filePath = require.resolve(join("@allurereport/web-classic/dist", singleFile ? "single" : "multi", fileName));
|
|
189
195
|
if (key.includes(".woff")) {
|
|
190
196
|
headTags.push(createFontLinkTag(fileName));
|
|
191
197
|
}
|
|
@@ -195,17 +201,17 @@ export const generateStaticFiles = async (payload) => {
|
|
|
195
201
|
if (key === "main.js") {
|
|
196
202
|
bodyTags.push(createScriptTag(fileName));
|
|
197
203
|
}
|
|
198
|
-
if (singleFile) {
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
const fileContent = await readFile(filePath);
|
|
202
|
-
await reportFiles.addFile(basename(filePath), fileContent);
|
|
203
204
|
}
|
|
205
|
+
await copyReportStaticAssets(staticAssets, reportFiles);
|
|
204
206
|
}
|
|
205
207
|
else {
|
|
206
208
|
const mainJs = manifest["main.js"];
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
+
const mainCss = manifest["main.css"];
|
|
210
|
+
if (mainCss) {
|
|
211
|
+
const mainCssContent = getReportStaticAsset(staticAssets, mainCss);
|
|
212
|
+
headTags.push(createStylesLinkTag(`data:text/css;base64,${mainCssContent.toString("base64")}`));
|
|
213
|
+
}
|
|
214
|
+
const mainJsContentBuffer = getReportStaticAsset(staticAssets, mainJs);
|
|
209
215
|
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
|
|
210
216
|
}
|
|
211
217
|
const now = Date.now();
|
package/dist/plugin.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
var _ClassicPlugin_writer, _ClassicPlugin_generate;
|
|
13
13
|
import { createPluginSummary, } from "@allurereport/plugin-api";
|
|
14
14
|
import { preciseTreeLabels } from "@allurereport/plugin-api";
|
|
15
|
-
import { generateAttachmentsFiles, generateEnvironmentJson, generateHistoryDataPoints, generatePieChart, generateStaticFiles, generateStatistic, generateTestResults, generateTree, generateTreeByCategories, } from "./generators.js";
|
|
15
|
+
import { generateAllCharts, generateAttachmentsFiles, generateEnvironmentJson, generateHistoryDataPoints, generatePieChart, generateStaticFiles, generateStatistic, generateTestResults, generateTree, generateTreeByCategories, } from "./generators.js";
|
|
16
16
|
import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
|
|
17
17
|
export class ClassicPlugin {
|
|
18
18
|
constructor(options = {}) {
|
|
@@ -25,6 +25,7 @@ export class ClassicPlugin {
|
|
|
25
25
|
const attachments = await store.allAttachments();
|
|
26
26
|
await generateStatistic(__classPrivateFieldGet(this, _ClassicPlugin_writer, "f"), statistic);
|
|
27
27
|
await generatePieChart(__classPrivateFieldGet(this, _ClassicPlugin_writer, "f"), statistic);
|
|
28
|
+
await generateAllCharts(__classPrivateFieldGet(this, _ClassicPlugin_writer, "f"), store, this.options, context);
|
|
28
29
|
const convertedTrs = await generateTestResults(__classPrivateFieldGet(this, _ClassicPlugin_writer, "f"), store);
|
|
29
30
|
const treeLabels = preciseTreeLabels(!groupBy.length ? ["parentSuite", "suite", "subSuite"] : groupBy, convertedTrs, ({ labels }) => labels.map(({ name }) => name));
|
|
30
31
|
const behaviorLabels = preciseTreeLabels(!groupBy.length ? ["epic", "feature", "story"] : groupBy, convertedTrs, ({ labels }) => labels.map(({ name }) => name));
|
|
Binary file
|
package/dist/writer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ReportFiles, ResultFile } from "@allurereport/plugin-api";
|
|
2
|
-
import type { AwesomeTestResult } from "@allurereport/web-awesome";
|
|
1
|
+
import type { ReportTestResult, ReportFiles, ResultFile } from "@allurereport/plugin-api";
|
|
3
2
|
export interface ReportFile {
|
|
4
3
|
name: string;
|
|
5
4
|
value: string;
|
|
@@ -7,7 +6,7 @@ export interface ReportFile {
|
|
|
7
6
|
export interface ClassicDataWriter {
|
|
8
7
|
writeData(fileName: string, data: any): Promise<void>;
|
|
9
8
|
writeWidget(fileName: string, data: any): Promise<void>;
|
|
10
|
-
writeTestCase(test:
|
|
9
|
+
writeTestCase(test: ReportTestResult): Promise<void>;
|
|
11
10
|
writeAttachment(source: string, file: ResultFile): Promise<void>;
|
|
12
11
|
}
|
|
13
12
|
export declare class FileSystemReportDataWriter implements ClassicDataWriter {
|
|
@@ -16,14 +15,14 @@ export declare class FileSystemReportDataWriter implements ClassicDataWriter {
|
|
|
16
15
|
constructor(output: string);
|
|
17
16
|
writeData(fileName: string, data: any): Promise<void>;
|
|
18
17
|
writeWidget(fileName: string, data: any): Promise<void>;
|
|
19
|
-
writeTestCase(test:
|
|
18
|
+
writeTestCase(test: ReportTestResult): Promise<void>;
|
|
20
19
|
writeAttachment(source: string, file: ResultFile): Promise<void>;
|
|
21
20
|
}
|
|
22
21
|
export declare class InMemoryReportDataWriter implements ClassicDataWriter {
|
|
23
22
|
#private;
|
|
24
23
|
writeData(fileName: string, data: any): Promise<void>;
|
|
25
24
|
writeWidget(fileName: string, data: any): Promise<void>;
|
|
26
|
-
writeTestCase(test:
|
|
25
|
+
writeTestCase(test: ReportTestResult): Promise<void>;
|
|
27
26
|
writeAttachment(fileName: string, file: ResultFile): Promise<void>;
|
|
28
27
|
reportFiles(): ReportFile[];
|
|
29
28
|
}
|
|
@@ -33,5 +32,5 @@ export declare class ReportFileDataWriter implements ClassicDataWriter {
|
|
|
33
32
|
writeData(fileName: string, data: any): Promise<void>;
|
|
34
33
|
writeWidget(fileName: string, data: any): Promise<void>;
|
|
35
34
|
writeAttachment(source: string, file: ResultFile): Promise<void>;
|
|
36
|
-
writeTestCase(test:
|
|
35
|
+
writeTestCase(test: ReportTestResult): Promise<void>;
|
|
37
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-classic",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"description": "The classic version of Allure HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
".": "./dist/index.js"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "run clean && tsc --project ./tsconfig.json",
|
|
26
|
+
"build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-classic/dist/multi ./dist/static/report.tar",
|
|
27
27
|
"clean": "rimraf ./dist",
|
|
28
28
|
"test": "rimraf ./out && vitest run",
|
|
29
29
|
"lint": "oxlint --import-plugin src test features stories",
|
|
30
30
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/
|
|
34
|
-
"@allurereport/
|
|
35
|
-
"@allurereport/
|
|
36
|
-
"@allurereport/web-
|
|
37
|
-
"@allurereport/web-commons": "3.15.0",
|
|
33
|
+
"@allurereport/charts-api": "3.16.1",
|
|
34
|
+
"@allurereport/core-api": "3.16.1",
|
|
35
|
+
"@allurereport/plugin-api": "3.16.1",
|
|
36
|
+
"@allurereport/web-commons": "3.16.1",
|
|
38
37
|
"d3-shape": "^3.2.0",
|
|
39
38
|
"handlebars": "^4.7.9",
|
|
40
39
|
"markdown-it": "^14.2.0"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
42
|
+
"@allurereport/web-classic": "3.16.1",
|
|
43
43
|
"@types/d3-shape": "^3.1.8",
|
|
44
44
|
"@types/markdown-it": "^14.1.2",
|
|
45
45
|
"@types/node": "^20",
|