@allurereport/plugin-allure2 3.21.0 → 3.22.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/categories.js +1 -1
- package/dist/generators.d.ts +0 -3
- package/dist/generators.js +1 -9
- package/dist/static/report.tar +0 -0
- package/dist/tree.js +4 -2
- package/dist/writer.d.ts +0 -9
- package/dist/writer.js +1 -47
- package/package.json +12 -10
package/dist/categories.js
CHANGED
package/dist/generators.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { AttachmentLink, GlobalAttachmentLink, HistoryDataPoint, TestError } from "@allurereport/core-api";
|
|
2
2
|
import type { ExitCode, ReportFiles, ResultFile } from "@allurereport/plugin-api";
|
|
3
|
-
import type { ReportStaticManifest } from "@allurereport/plugin-api/static-assets";
|
|
4
3
|
import type { Allure2CategoriesTrendItem, Allure2DurationTrendItem, Allure2ExecutorInfo, Allure2LegacyHistoryTrendItem, Allure2RetryTrendItem, Allure2TestResult } from "./model.js";
|
|
5
4
|
import type { Allure2DataWriter, ReportFile } from "./writer.js";
|
|
6
|
-
export type TemplateManifest = ReportStaticManifest;
|
|
7
|
-
export declare const readTemplateManifest: () => Promise<TemplateManifest>;
|
|
8
5
|
export declare const generateStaticFiles: (payload: {
|
|
9
6
|
allureVersion: string;
|
|
10
7
|
reportName: string;
|
package/dist/generators.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { createBaseUrlScript, createScriptTag, createStylesLinkTag, stringifyForInlineScript, } from "@allurereport/core-api";
|
|
2
|
+
import { writeConcurrently } from "@allurereport/plugin-api/internal/report";
|
|
2
3
|
import { copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
|
|
3
4
|
import Handlebars from "handlebars";
|
|
4
5
|
import { byLabels, collapseTree, createTree, createWidget } from "./tree.js";
|
|
5
6
|
import { createStatistic, updateStatistic, updateTime } from "./utils.js";
|
|
6
7
|
const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
|
|
7
|
-
const writeConcurrently = async (items, write, concurrency = 64) => {
|
|
8
|
-
for (let i = 0; i < items.length; i += concurrency) {
|
|
9
|
-
await Promise.all(items.slice(i, i + concurrency).map(write));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
8
|
const template = `<!DOCTYPE html>
|
|
13
9
|
<html dir="ltr" lang="{{reportLanguage}}">
|
|
14
10
|
<head>
|
|
@@ -94,10 +90,6 @@ const injectEmbeddedReportDataScript = (html, reportFiles) => {
|
|
|
94
90
|
`), Buffer.from(html.slice(placeholderIndex + reportDataScriptPlaceholder.length), "utf8"));
|
|
95
91
|
return Buffer.concat(chunks);
|
|
96
92
|
};
|
|
97
|
-
export const readTemplateManifest = async () => {
|
|
98
|
-
const { manifest } = await readReportStaticAssets(reportStaticArchive);
|
|
99
|
-
return manifest;
|
|
100
|
-
};
|
|
101
93
|
export const generateStaticFiles = async (payload) => {
|
|
102
94
|
const { reportName, reportLanguage, singleFile, reportFiles, reportDataFiles, reportUuid, allureVersion, overviewHref, } = payload;
|
|
103
95
|
const staticAssets = await readReportStaticAssets(reportStaticArchive);
|
package/dist/static/report.tar
CHANGED
|
Binary file
|
package/dist/tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { byStatistic, compareBy } from "@allurereport/core-api";
|
|
1
|
+
import { byStatistic, compareBy, nullsFirst, ordinal } from "@allurereport/core-api";
|
|
2
2
|
import { md5 } from "@allurereport/plugin-api";
|
|
3
3
|
import { calculateStatisticByLeafs } from "./utils.js";
|
|
4
4
|
const rootNodeUid = "__ROOT__";
|
|
@@ -28,7 +28,9 @@ export const createTree = (tests, classifier, leafFactory = createLeaf) => {
|
|
|
28
28
|
const groups = new Map();
|
|
29
29
|
const root = { uid: rootNodeUid, name: rootNodeUid, children: [] };
|
|
30
30
|
groups.set(root.uid, root);
|
|
31
|
-
|
|
31
|
+
const compareStart = nullsFirst(ordinal());
|
|
32
|
+
const orderedTests = [...tests].sort((a, b) => compareStart(a.time.start, b.time.start) || (a.uid < b.uid ? -1 : a.uid > b.uid ? 1 : 0));
|
|
33
|
+
for (const test of orderedTests) {
|
|
32
34
|
const treeLayers = classifier(test);
|
|
33
35
|
if (!treeLayers) {
|
|
34
36
|
continue;
|
package/dist/writer.d.ts
CHANGED
|
@@ -10,15 +10,6 @@ export interface Allure2DataWriter {
|
|
|
10
10
|
writeTestCase(test: Allure2TestResult): Promise<void>;
|
|
11
11
|
writeAttachment(source: string, file: ResultFile): Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
export declare class FileSystemReportDataWriter implements Allure2DataWriter {
|
|
14
|
-
#private;
|
|
15
|
-
private readonly output;
|
|
16
|
-
constructor(output: string);
|
|
17
|
-
writeData(fileName: string, data: any): Promise<void>;
|
|
18
|
-
writeWidget(fileName: string, data: any): Promise<void>;
|
|
19
|
-
writeTestCase(test: Allure2TestResult): Promise<void>;
|
|
20
|
-
writeAttachment(source: string, file: ResultFile): Promise<void>;
|
|
21
|
-
}
|
|
22
13
|
export declare class InMemoryReportDataWriter implements Allure2DataWriter {
|
|
23
14
|
#private;
|
|
24
15
|
writeData(fileName: string, data: any): Promise<void>;
|
package/dist/writer.js
CHANGED
|
@@ -1,56 +1,10 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
1
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
2
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
5
|
};
|
|
12
|
-
var
|
|
13
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
14
|
-
import { resolve } from "node:path";
|
|
6
|
+
var _InMemoryReportDataWriter_data;
|
|
15
7
|
import { joinPosixPath } from "@allurereport/core-api";
|
|
16
|
-
export class FileSystemReportDataWriter {
|
|
17
|
-
constructor(output) {
|
|
18
|
-
this.output = output;
|
|
19
|
-
_FileSystemReportDataWriter_dataDir.set(this, void 0);
|
|
20
|
-
_FileSystemReportDataWriter_widgetsDir.set(this, void 0);
|
|
21
|
-
_FileSystemReportDataWriter_testCasesDir.set(this, void 0);
|
|
22
|
-
_FileSystemReportDataWriter_attachmentsDir.set(this, void 0);
|
|
23
|
-
_FileSystemReportDataWriter_dataDirReady.set(this, void 0);
|
|
24
|
-
_FileSystemReportDataWriter_widgetsDirReady.set(this, void 0);
|
|
25
|
-
_FileSystemReportDataWriter_testCasesDirReady.set(this, void 0);
|
|
26
|
-
_FileSystemReportDataWriter_attachmentsDirReady.set(this, void 0);
|
|
27
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_dataDir, resolve(this.output, "data"), "f");
|
|
28
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_widgetsDir, resolve(this.output, "widgets"), "f");
|
|
29
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_testCasesDir, resolve(this.output, "data", "test-cases"), "f");
|
|
30
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_attachmentsDir, resolve(this.output, "data", "attachments"), "f");
|
|
31
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_dataDirReady, mkdir(__classPrivateFieldGet(this, _FileSystemReportDataWriter_dataDir, "f"), { recursive: true }), "f");
|
|
32
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_widgetsDirReady, mkdir(__classPrivateFieldGet(this, _FileSystemReportDataWriter_widgetsDir, "f"), { recursive: true }), "f");
|
|
33
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_testCasesDirReady, mkdir(__classPrivateFieldGet(this, _FileSystemReportDataWriter_testCasesDir, "f"), { recursive: true }), "f");
|
|
34
|
-
__classPrivateFieldSet(this, _FileSystemReportDataWriter_attachmentsDirReady, mkdir(__classPrivateFieldGet(this, _FileSystemReportDataWriter_attachmentsDir, "f"), { recursive: true }), "f");
|
|
35
|
-
}
|
|
36
|
-
async writeData(fileName, data) {
|
|
37
|
-
await __classPrivateFieldGet(this, _FileSystemReportDataWriter_dataDirReady, "f");
|
|
38
|
-
await writeFile(resolve(__classPrivateFieldGet(this, _FileSystemReportDataWriter_dataDir, "f"), fileName), JSON.stringify(data), { encoding: "utf-8" });
|
|
39
|
-
}
|
|
40
|
-
async writeWidget(fileName, data) {
|
|
41
|
-
await __classPrivateFieldGet(this, _FileSystemReportDataWriter_widgetsDirReady, "f");
|
|
42
|
-
await writeFile(resolve(__classPrivateFieldGet(this, _FileSystemReportDataWriter_widgetsDir, "f"), fileName), JSON.stringify(data), { encoding: "utf-8" });
|
|
43
|
-
}
|
|
44
|
-
async writeTestCase(test) {
|
|
45
|
-
await __classPrivateFieldGet(this, _FileSystemReportDataWriter_testCasesDirReady, "f");
|
|
46
|
-
await writeFile(resolve(__classPrivateFieldGet(this, _FileSystemReportDataWriter_testCasesDir, "f"), `${test.uid}.json`), JSON.stringify(test), { encoding: "utf-8" });
|
|
47
|
-
}
|
|
48
|
-
async writeAttachment(source, file) {
|
|
49
|
-
await __classPrivateFieldGet(this, _FileSystemReportDataWriter_attachmentsDirReady, "f");
|
|
50
|
-
await file.writeTo(resolve(__classPrivateFieldGet(this, _FileSystemReportDataWriter_attachmentsDir, "f"), source));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
_FileSystemReportDataWriter_dataDir = new WeakMap(), _FileSystemReportDataWriter_widgetsDir = new WeakMap(), _FileSystemReportDataWriter_testCasesDir = new WeakMap(), _FileSystemReportDataWriter_attachmentsDir = new WeakMap(), _FileSystemReportDataWriter_dataDirReady = new WeakMap(), _FileSystemReportDataWriter_widgetsDirReady = new WeakMap(), _FileSystemReportDataWriter_testCasesDirReady = new WeakMap(), _FileSystemReportDataWriter_attachmentsDirReady = new WeakMap();
|
|
54
8
|
export class InMemoryReportDataWriter {
|
|
55
9
|
constructor() {
|
|
56
10
|
_InMemoryReportDataWriter_data.set(this, {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-allure2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"description": "The Allure 2-compatible HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -25,26 +25,28 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-allure2/dist/multi ./dist/static/report.tar",
|
|
27
27
|
"clean": "rimraf ./dist",
|
|
28
|
-
"test": "rimraf
|
|
28
|
+
"test": "rimraf out && vp test run",
|
|
29
29
|
"test:unit": "yarn test",
|
|
30
|
-
"lint": "
|
|
31
|
-
"lint:fix": "
|
|
30
|
+
"lint": "vp lint --import-plugin src test features stories",
|
|
31
|
+
"lint:fix": "vp lint --import-plugin --fix src test features stories"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@allurereport/core-api": "3.
|
|
35
|
-
"@allurereport/plugin-api": "3.
|
|
34
|
+
"@allurereport/core-api": "3.22.0",
|
|
35
|
+
"@allurereport/plugin-api": "3.22.0",
|
|
36
36
|
"handlebars": "4.7.10"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@allurereport/
|
|
40
|
-
"@allurereport/web-allure2": "3.
|
|
39
|
+
"@allurereport/common-config": "3.22.0",
|
|
40
|
+
"@allurereport/web-allure2": "3.22.0",
|
|
41
41
|
"@types/node": "^20",
|
|
42
|
-
"@vitest/coverage-istanbul": "
|
|
42
|
+
"@vitest/coverage-istanbul": "5.0.4",
|
|
43
43
|
"@vitest/runner": "^2",
|
|
44
44
|
"allure-js-commons": "^3",
|
|
45
45
|
"allure-vitest": "^3",
|
|
46
46
|
"rimraf": "^6",
|
|
47
47
|
"typescript": "^5",
|
|
48
|
-
"
|
|
48
|
+
"vite": "@voidzero-dev/vite-plus-core@1.2.0",
|
|
49
|
+
"vite-plus": "1.2.0",
|
|
50
|
+
"vitest": "5.0.4"
|
|
49
51
|
}
|
|
50
52
|
}
|