@allurereport/plugin-classic 3.16.0 → 3.17.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/dist/converters.d.ts +4 -4
- package/dist/converters.js +0 -1
- package/dist/generators.d.ts +5 -6
- package/dist/generators.js +15 -18
- package/dist/static/report.tar +0 -0
- package/dist/writer.d.ts +5 -6
- package/package.json +7 -8
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,11 +1,10 @@
|
|
|
1
1
|
import { type AttachmentLink, type EnvironmentItem, type Statistic } from "@allurereport/core-api";
|
|
2
|
-
import { type AllureStore, type PluginContext, 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>;
|
|
@@ -19,4 +18,4 @@ export declare const generateStaticFiles: (payload: ClassicOptions & {
|
|
|
19
18
|
reportUuid: string;
|
|
20
19
|
reportName: string;
|
|
21
20
|
}) => Promise<void>;
|
|
22
|
-
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,15 +1,13 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
import { basename, join } from "node:path";
|
|
5
2
|
import { defaultChartsConfig } from "@allurereport/charts-api";
|
|
6
3
|
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
7
4
|
import { createTreeByCategories, createTreeByLabels, processTree, } from "@allurereport/plugin-api";
|
|
5
|
+
import { copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
|
|
8
6
|
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
9
7
|
import Handlebars from "handlebars";
|
|
10
8
|
import { matchCategories } from "./categories.js";
|
|
11
9
|
import { convertFixtureResult, convertTestResult } from "./converters.js";
|
|
12
|
-
const
|
|
10
|
+
const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
|
|
13
11
|
const template = `<!DOCTYPE html>
|
|
14
12
|
<html dir="ltr" lang="en">
|
|
15
13
|
<head>
|
|
@@ -52,10 +50,9 @@ const writeConcurrently = async (items, write, concurrency = 64) => {
|
|
|
52
50
|
await Promise.all(items.slice(i, i + concurrency).map(write));
|
|
53
51
|
}
|
|
54
52
|
};
|
|
55
|
-
export const readTemplateManifest = async (
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
return JSON.parse(templateManifest);
|
|
53
|
+
export const readTemplateManifest = async (_singleFileMode) => {
|
|
54
|
+
const { manifest } = await readReportStaticAssets(reportStaticArchive);
|
|
55
|
+
return manifest;
|
|
59
56
|
};
|
|
60
57
|
const createBreadcrumbs = (convertedTr) => {
|
|
61
58
|
const labelsByType = convertedTr.labels.reduce((acc, label) => {
|
|
@@ -187,14 +184,14 @@ export const generateHistoryDataPoints = async (writer, store) => {
|
|
|
187
184
|
return result;
|
|
188
185
|
};
|
|
189
186
|
export const generateStaticFiles = async (payload) => {
|
|
190
|
-
const { reportName = "Allure Report", reportLanguage = "en",
|
|
191
|
-
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;
|
|
192
190
|
const headTags = [];
|
|
193
191
|
const bodyTags = [];
|
|
194
192
|
if (!payload.singleFile) {
|
|
195
193
|
for (const key in manifest) {
|
|
196
194
|
const fileName = manifest[key];
|
|
197
|
-
const filePath = require.resolve(join("@allurereport/web-classic/dist", singleFile ? "single" : "multi", fileName));
|
|
198
195
|
if (key.includes(".woff")) {
|
|
199
196
|
headTags.push(createFontLinkTag(fileName));
|
|
200
197
|
}
|
|
@@ -204,17 +201,17 @@ export const generateStaticFiles = async (payload) => {
|
|
|
204
201
|
if (key === "main.js") {
|
|
205
202
|
bodyTags.push(createScriptTag(fileName));
|
|
206
203
|
}
|
|
207
|
-
if (singleFile) {
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
const fileContent = await readFile(filePath);
|
|
211
|
-
await reportFiles.addFile(basename(filePath), fileContent);
|
|
212
204
|
}
|
|
205
|
+
await copyReportStaticAssets(staticAssets, reportFiles);
|
|
213
206
|
}
|
|
214
207
|
else {
|
|
215
208
|
const mainJs = manifest["main.js"];
|
|
216
|
-
const
|
|
217
|
-
|
|
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);
|
|
218
215
|
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
|
|
219
216
|
}
|
|
220
217
|
const now = Date.now();
|
|
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.17.0",
|
|
4
4
|
"description": "The classic version of Allure HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -23,24 +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/charts-api": "3.
|
|
34
|
-
"@allurereport/core-api": "3.
|
|
35
|
-
"@allurereport/plugin-api": "3.
|
|
36
|
-
"@allurereport/web-
|
|
37
|
-
"@allurereport/web-classic": "3.16.0",
|
|
38
|
-
"@allurereport/web-commons": "3.16.0",
|
|
33
|
+
"@allurereport/charts-api": "3.17.0",
|
|
34
|
+
"@allurereport/core-api": "3.17.0",
|
|
35
|
+
"@allurereport/plugin-api": "3.17.0",
|
|
36
|
+
"@allurereport/web-commons": "3.17.0",
|
|
39
37
|
"d3-shape": "^3.2.0",
|
|
40
38
|
"handlebars": "^4.7.9",
|
|
41
39
|
"markdown-it": "^14.2.0"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
42
|
+
"@allurereport/web-classic": "3.17.0",
|
|
44
43
|
"@types/d3-shape": "^3.1.8",
|
|
45
44
|
"@types/markdown-it": "^14.1.2",
|
|
46
45
|
"@types/node": "^20",
|