cucumber-reactive-reporter 1.1.0 → 1.1.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.
|
@@ -79,6 +79,17 @@ const decodeBase64Text = value => {
|
|
|
79
79
|
}
|
|
80
80
|
return decoded;
|
|
81
81
|
};
|
|
82
|
+
const formatJsonText = value => {
|
|
83
|
+
if (typeof value !== "string") {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const parsed = JSON.parse(value);
|
|
88
|
+
return JSON.stringify(parsed, null, 2);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
82
93
|
const normalizeEmbeddings = (embeddings, {
|
|
83
94
|
attachmentsEncoding
|
|
84
95
|
}) => {
|
|
@@ -95,10 +106,19 @@ const normalizeEmbedding = (embedding, {
|
|
|
95
106
|
if (!embedding || typeof embedding !== "object") {
|
|
96
107
|
return embedding;
|
|
97
108
|
}
|
|
109
|
+
const mimeType = normalizeMimeType(embedding.mime_type ?? embedding.media?.type);
|
|
98
110
|
if (attachmentsEncoding === "raw") {
|
|
111
|
+
if (mimeType === "application/json" && typeof embedding.data === "string") {
|
|
112
|
+
const formatted = formatJsonText(embedding.data);
|
|
113
|
+
if (formatted) {
|
|
114
|
+
return {
|
|
115
|
+
...embedding,
|
|
116
|
+
data: formatted
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
99
120
|
return embedding;
|
|
100
121
|
}
|
|
101
|
-
const mimeType = normalizeMimeType(embedding.mime_type ?? embedding.media?.type);
|
|
102
122
|
if (!shouldDecodeEmbedding(mimeType)) {
|
|
103
123
|
return embedding;
|
|
104
124
|
}
|
|
@@ -111,11 +131,14 @@ const normalizeEmbedding = (embedding, {
|
|
|
111
131
|
return embedding;
|
|
112
132
|
}
|
|
113
133
|
if (mimeType === "application/json") {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} catch (err) {
|
|
134
|
+
const formatted = formatJsonText(decoded);
|
|
135
|
+
if (!formatted) {
|
|
117
136
|
return embedding;
|
|
118
137
|
}
|
|
138
|
+
return {
|
|
139
|
+
...embedding,
|
|
140
|
+
data: formatted
|
|
141
|
+
};
|
|
119
142
|
} else if (["application/xml", "text/xml", "text/html"].includes(mimeType)) {
|
|
120
143
|
if (!decoded.includes("<")) {
|
|
121
144
|
return embedding;
|
|
@@ -75,6 +75,17 @@ const decodeBase64Text = value => {
|
|
|
75
75
|
}
|
|
76
76
|
return decoded;
|
|
77
77
|
};
|
|
78
|
+
const formatJsonText = value => {
|
|
79
|
+
if (typeof value !== "string") {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const parsed = JSON.parse(value);
|
|
84
|
+
return JSON.stringify(parsed, null, 2);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
78
89
|
const normalizeEmbeddings = (embeddings, {
|
|
79
90
|
attachmentsEncoding
|
|
80
91
|
}) => {
|
|
@@ -91,10 +102,19 @@ const normalizeEmbedding = (embedding, {
|
|
|
91
102
|
if (!embedding || typeof embedding !== "object") {
|
|
92
103
|
return embedding;
|
|
93
104
|
}
|
|
105
|
+
const mimeType = normalizeMimeType(embedding.mime_type ?? embedding.media?.type);
|
|
94
106
|
if (attachmentsEncoding === "raw") {
|
|
107
|
+
if (mimeType === "application/json" && typeof embedding.data === "string") {
|
|
108
|
+
const formatted = formatJsonText(embedding.data);
|
|
109
|
+
if (formatted) {
|
|
110
|
+
return {
|
|
111
|
+
...embedding,
|
|
112
|
+
data: formatted
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
95
116
|
return embedding;
|
|
96
117
|
}
|
|
97
|
-
const mimeType = normalizeMimeType(embedding.mime_type ?? embedding.media?.type);
|
|
98
118
|
if (!shouldDecodeEmbedding(mimeType)) {
|
|
99
119
|
return embedding;
|
|
100
120
|
}
|
|
@@ -107,11 +127,14 @@ const normalizeEmbedding = (embedding, {
|
|
|
107
127
|
return embedding;
|
|
108
128
|
}
|
|
109
129
|
if (mimeType === "application/json") {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
} catch (err) {
|
|
130
|
+
const formatted = formatJsonText(decoded);
|
|
131
|
+
if (!formatted) {
|
|
113
132
|
return embedding;
|
|
114
133
|
}
|
|
134
|
+
return {
|
|
135
|
+
...embedding,
|
|
136
|
+
data: formatted
|
|
137
|
+
};
|
|
115
138
|
} else if (["application/xml", "text/xml", "text/html"].includes(mimeType)) {
|
|
116
139
|
if (!decoded.includes("<")) {
|
|
117
140
|
return embedding;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cucumber-reactive-reporter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A filterable html report generator for cucumberjs written in react",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/unsuspecting-noob/cucumber-reactive-reporter",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cucumber-reactive-reporter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A filterable html report generator for cucumberjs written in react",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/unsuspecting-noob/cucumber-reactive-reporter",
|