@allurereport/core-api 3.20.1 → 3.21.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/aggregate.d.ts +1 -0
- package/dist/categories.d.ts +1 -0
- package/dist/history.d.ts +1 -0
- package/dist/static.d.ts +5 -0
- package/dist/static.js +53 -1
- package/dist/utils/status.d.ts +2 -1
- package/dist/utils/status.js +3 -0
- package/package.json +4 -1
package/dist/aggregate.d.ts
CHANGED
package/dist/categories.d.ts
CHANGED
package/dist/history.d.ts
CHANGED
package/dist/static.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export declare const appLoaderStyles = "\n <style>\n .allure-app-loader {\n
|
|
|
11
11
|
export declare const createAppLoaderMarkup: () => string;
|
|
12
12
|
export declare const createBaseUrlScript: () => string;
|
|
13
13
|
export declare const stringifyForInlineScript: (value: unknown) => string;
|
|
14
|
+
export declare const reportDataScriptPlaceholder = "<!-- allure-report-data -->";
|
|
15
|
+
export declare const injectReportDataScript: (html: string, reportFiles?: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[]) => Buffer;
|
|
14
19
|
export declare const createReportDataScript: (reportFiles?: {
|
|
15
20
|
name: string;
|
|
16
21
|
value: string;
|
package/dist/static.js
CHANGED
|
@@ -90,6 +90,58 @@ export const stringifyForInlineScript = (value) => {
|
|
|
90
90
|
.replaceAll("\u2028", "\\u2028")
|
|
91
91
|
.replaceAll("\u2029", "\\u2029");
|
|
92
92
|
};
|
|
93
|
+
export const reportDataScriptPlaceholder = "<!-- allure-report-data -->";
|
|
94
|
+
const createReportDataScriptChunks = (reportFiles = []) => {
|
|
95
|
+
if (!reportFiles.length) {
|
|
96
|
+
return [
|
|
97
|
+
Buffer.from(`
|
|
98
|
+
<script async>
|
|
99
|
+
window.allureReportDataReady = true;
|
|
100
|
+
</script>
|
|
101
|
+
`),
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
const chunks = [
|
|
105
|
+
Buffer.from(`
|
|
106
|
+
<script async>
|
|
107
|
+
window.allureReportDataReady = false;
|
|
108
|
+
window.allureReportData = window.allureReportData || {};
|
|
109
|
+
|
|
110
|
+
function d(name, value){
|
|
111
|
+
return new Promise(function (resolve) {
|
|
112
|
+
window.allureReportData[name] = value;
|
|
113
|
+
|
|
114
|
+
return resolve(true);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<script defer>
|
|
119
|
+
Promise.allSettled([`),
|
|
120
|
+
];
|
|
121
|
+
reportFiles.forEach(({ name, value }, index) => {
|
|
122
|
+
chunks.push(Buffer.from(`${index === 0 ? "" : ","}d(${stringifyForInlineScript(name)},${stringifyForInlineScript(value)})`));
|
|
123
|
+
});
|
|
124
|
+
chunks.push(Buffer.from(`])
|
|
125
|
+
.then(function(){
|
|
126
|
+
window.allureReportDataReady = true;
|
|
127
|
+
})
|
|
128
|
+
</script>
|
|
129
|
+
`));
|
|
130
|
+
return chunks;
|
|
131
|
+
};
|
|
132
|
+
export const injectReportDataScript = (html, reportFiles = []) => {
|
|
133
|
+
const placeholderIndex = html.indexOf(reportDataScriptPlaceholder);
|
|
134
|
+
if (placeholderIndex === -1) {
|
|
135
|
+
throw new Error("Report data script placeholder is missing from the HTML template");
|
|
136
|
+
}
|
|
137
|
+
const prefix = html.slice(0, placeholderIndex);
|
|
138
|
+
const suffix = html.slice(placeholderIndex + reportDataScriptPlaceholder.length);
|
|
139
|
+
return Buffer.concat([
|
|
140
|
+
Buffer.from(prefix, "utf8"),
|
|
141
|
+
...createReportDataScriptChunks(reportFiles),
|
|
142
|
+
Buffer.from(suffix, "utf8"),
|
|
143
|
+
]);
|
|
144
|
+
};
|
|
93
145
|
export const createReportDataScript = (reportFiles = []) => {
|
|
94
146
|
if (!reportFiles?.length) {
|
|
95
147
|
return `
|
|
@@ -99,7 +151,7 @@ export const createReportDataScript = (reportFiles = []) => {
|
|
|
99
151
|
`;
|
|
100
152
|
}
|
|
101
153
|
const reportFilesDeclaration = reportFiles
|
|
102
|
-
.map(({ name, value }) => `d(${
|
|
154
|
+
.map(({ name, value }) => `d(${stringifyForInlineScript(name)},${stringifyForInlineScript(value)})`)
|
|
103
155
|
.join(",");
|
|
104
156
|
return `
|
|
105
157
|
<script async>
|
package/dist/utils/status.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TestStatus } from "../model.js";
|
|
1
|
+
import type { TestResult, TestStatus } from "../model.js";
|
|
2
2
|
export declare const StatusByPriority: TestStatus[];
|
|
3
3
|
export declare const statusToPriority: (status: TestStatus | undefined) => number;
|
|
4
4
|
export declare const getWorstStatus: (items: TestStatus[]) => TestStatus | undefined;
|
|
5
|
+
export declare const hasRetriesStatusChange: (current: Pick<TestResult, "status">, retries: readonly Pick<TestResult, "status">[]) => boolean;
|
package/dist/utils/status.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const retryStatusChangeStatuses = new Set(["failed", "broken", "passed"]);
|
|
1
2
|
export const StatusByPriority = ["failed", "broken", "passed", "skipped", "unknown"];
|
|
2
3
|
export const statusToPriority = (status) => {
|
|
3
4
|
if (!status) {
|
|
@@ -11,3 +12,5 @@ export const getWorstStatus = (items) => {
|
|
|
11
12
|
}
|
|
12
13
|
return items.sort((a, b) => statusToPriority(a) - statusToPriority(b))[0];
|
|
13
14
|
};
|
|
15
|
+
export const hasRetriesStatusChange = (current, retries) => retryStatusChangeStatuses.has(current.status) &&
|
|
16
|
+
retries.some(({ status }) => retryStatusChangeStatuses.has(status) && status !== current.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Allure Core API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
23
23
|
"clean": "rimraf ./dist",
|
|
24
24
|
"test": "rimraf ./out && vitest run",
|
|
25
|
+
"test:unit": "yarn test",
|
|
25
26
|
"lint": "oxlint --import-plugin src test features stories",
|
|
26
27
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
27
28
|
},
|
|
@@ -29,8 +30,10 @@
|
|
|
29
30
|
"d3-shape": "^3.2.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
33
|
+
"@allurereport/test-config": "3.21.0",
|
|
32
34
|
"@types/d3-shape": "^3.1.8",
|
|
33
35
|
"@types/node": "^20",
|
|
36
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
34
37
|
"@vitest/runner": "^2",
|
|
35
38
|
"@vitest/snapshot": "^5.0.1",
|
|
36
39
|
"allure-js-commons": "^3",
|