@allurereport/web-commons 3.19.0 → 3.20.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.
|
@@ -25,7 +25,7 @@ const addLeafToGroupFn = (group, leaf) => {
|
|
|
25
25
|
group.failedTests += leaf.status === "failed" ? 1 : 0;
|
|
26
26
|
group.otherTests += leaf?.status && !["passed", "failed"].includes(leaf.status) ? 1 : 0;
|
|
27
27
|
};
|
|
28
|
-
const calculateColorValue = ({ eligibleCount, passedTests }) => getSuccessRate({ passed: passedTests, failed: eligibleCount - passedTests });
|
|
28
|
+
const calculateColorValue = ({ eligibleCount, passedTests }) => eligibleCount > 0 ? getSuccessRate({ passed: passedTests, failed: eligibleCount - passedTests }) : undefined;
|
|
29
29
|
const calculateSubtreeMetrics = (node) => {
|
|
30
30
|
if (!node.children || node.children.length === 0) {
|
|
31
31
|
return {
|
package/dist/strings.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export interface AnsiToHtmlConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const isAnsi: (text?: string) => boolean;
|
|
12
12
|
export declare const ansiSemanticColors: Record<number, string>;
|
|
13
|
+
export declare const normalizeEscapedAnsiSequences: (text: string) => string;
|
|
13
14
|
export declare const normalizeAnsiForegroundColors: (text: string) => string;
|
|
14
15
|
export declare const ansiToHTML: (text: string, config?: AnsiToHtmlConfig) => string;
|
package/dist/strings.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import AnsiToHtml from "ansi-to-html";
|
|
2
2
|
const ansiRegex = /\x1B\[[0-9;?]*[ -/]*[@-~]/g;
|
|
3
|
+
const ansiEscape = "\u001B";
|
|
4
|
+
const ansiControlSequencePattern = new RegExp(`${ansiEscape}\\[([0-9;]*)m`, "g");
|
|
3
5
|
export const isAnsi = (text) => typeof text === "string" && new RegExp(ansiRegex).test(text);
|
|
4
6
|
const semanticAnsiColor = {
|
|
5
7
|
primary: 256,
|
|
@@ -81,7 +83,8 @@ const getXtermColorRgb = (colorIndex) => {
|
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
const isValidColorPart = (value) => Number.isInteger(value) && value >= 0 && value <= 255;
|
|
84
|
-
export const
|
|
86
|
+
export const normalizeEscapedAnsiSequences = (text) => text.replace(/\\u001b(?=\[)/giu, ansiEscape).replace(/\\x1b(?=\[)/giu, ansiEscape);
|
|
87
|
+
export const normalizeAnsiForegroundColors = (text) => text.replace(ansiControlSequencePattern, (match, sequence) => {
|
|
85
88
|
const codes = sequence.length === 0 ? [0] : sequence.split(";").map(Number);
|
|
86
89
|
if (codes.some((code) => !Number.isInteger(code))) {
|
|
87
90
|
return match;
|
|
@@ -114,8 +117,6 @@ export const normalizeAnsiForegroundColors = (text) => text.replace(/\x1b\[([0-9
|
|
|
114
117
|
continue;
|
|
115
118
|
}
|
|
116
119
|
if (code === 48 && codes[index + 1] === 5 && isValidColorPart(codes[index + 2])) {
|
|
117
|
-
flushDisplayCodes();
|
|
118
|
-
fragments.push(`\x1b[48;5;${codes[index + 2]}m`);
|
|
119
120
|
index += 3;
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
@@ -124,11 +125,13 @@ export const normalizeAnsiForegroundColors = (text) => text.replace(/\x1b\[([0-9
|
|
|
124
125
|
isValidColorPart(codes[index + 2]) &&
|
|
125
126
|
isValidColorPart(codes[index + 3]) &&
|
|
126
127
|
isValidColorPart(codes[index + 4])) {
|
|
127
|
-
flushDisplayCodes();
|
|
128
|
-
fragments.push(`\x1b[48;2;${codes[index + 2]};${codes[index + 3]};${codes[index + 4]}m`);
|
|
129
128
|
index += 5;
|
|
130
129
|
continue;
|
|
131
130
|
}
|
|
131
|
+
if ((code >= 40 && code <= 47) || code === 49 || (code >= 100 && code <= 107)) {
|
|
132
|
+
index += 1;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
132
135
|
displayCodes.push(code);
|
|
133
136
|
index += 1;
|
|
134
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-commons",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"description": "Collection of utilities used across the web Allure reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@allurereport/aql": "3.
|
|
30
|
-
"@allurereport/charts-api": "3.
|
|
31
|
-
"@allurereport/core-api": "3.
|
|
32
|
-
"@allurereport/plugin-api": "3.
|
|
29
|
+
"@allurereport/aql": "3.20.0",
|
|
30
|
+
"@allurereport/charts-api": "3.20.0",
|
|
31
|
+
"@allurereport/core-api": "3.20.0",
|
|
32
|
+
"@allurereport/plugin-api": "3.20.0",
|
|
33
33
|
"@preact/signals": "^2.6.1",
|
|
34
34
|
"@preact/signals-core": "^1.12.2",
|
|
35
35
|
"ansi-to-html": "^0.7.2",
|