@testomatio/reporter 2.5.0 → 2.5.2
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/lib/adapter/jest.js +1 -2
- package/lib/adapter/playwright.d.ts +3 -2
- package/lib/adapter/playwright.js +23 -17
- package/package.json +1 -1
- package/src/adapter/jest.js +1 -2
- package/src/adapter/playwright.js +24 -18
package/lib/adapter/jest.js
CHANGED
|
@@ -43,8 +43,7 @@ class JestReporter {
|
|
|
43
43
|
let steps;
|
|
44
44
|
const { status, title, duration, failureMessages } = result;
|
|
45
45
|
if (failureMessages[0]) {
|
|
46
|
-
|
|
47
|
-
errorMessage = errorMessage.split('\n')[0];
|
|
46
|
+
const errorMessage = failureMessages[0].replace((0, utils_js_1.ansiRegExp)(), '');
|
|
48
47
|
error = new Error(errorMessage);
|
|
49
48
|
steps = failureMessages[0];
|
|
50
49
|
}
|
|
@@ -12,9 +12,10 @@ declare class PlaywrightReporter {
|
|
|
12
12
|
#private;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Extracts
|
|
15
|
+
* Extracts tags from test title, test options, and suite level
|
|
16
|
+
* Identifies duplicate tags (case-insensitive)
|
|
16
17
|
* @param {*} test - testInfo object from Playwright
|
|
17
|
-
* @returns {string[]} - array of normalized tags
|
|
18
|
+
* @returns {string[]} - array of normalized tags with @ prefix
|
|
18
19
|
*/
|
|
19
20
|
export function extractTags(test: any): string[];
|
|
20
21
|
import TestomatioClient from '../client.js';
|
|
@@ -92,7 +92,7 @@ class PlaywrightReporter {
|
|
|
92
92
|
test_id: (0, utils_js_1.getTestomatIdFromTestTitle)(`${title} ${tags.join(' ')}`),
|
|
93
93
|
suite_title,
|
|
94
94
|
title,
|
|
95
|
-
tags,
|
|
95
|
+
tags: tags.map(tag => tag.replace('@', '')),
|
|
96
96
|
steps: steps.length ? steps : undefined,
|
|
97
97
|
time: duration,
|
|
98
98
|
logs,
|
|
@@ -223,27 +223,33 @@ function generateTmpFilepath(filename = '') {
|
|
|
223
223
|
return path_1.default.join(tmpdir, filename);
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
|
-
* Extracts
|
|
226
|
+
* Extracts tags from test title, test options, and suite level
|
|
227
|
+
* Identifies duplicate tags (case-insensitive)
|
|
227
228
|
* @param {*} test - testInfo object from Playwright
|
|
228
|
-
* @returns {string[]} - array of normalized tags
|
|
229
|
+
* @returns {string[]} - array of normalized tags with @ prefix
|
|
229
230
|
*/
|
|
230
231
|
function extractTags(test) {
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
const tagsMap = new Map(); // key: lowercase tag, value: original case tag
|
|
233
|
+
function addTag(tag) {
|
|
234
|
+
if (typeof tag !== 'string')
|
|
235
|
+
return;
|
|
236
|
+
const trimmed = tag.trim();
|
|
237
|
+
if (!trimmed)
|
|
238
|
+
return;
|
|
239
|
+
const normalizedTag = trimmed.startsWith('@') ? trimmed : `@${trimmed}`;
|
|
240
|
+
const lowercaseTag = normalizedTag.toLowerCase();
|
|
241
|
+
if (!tagsMap.has(lowercaseTag)) {
|
|
242
|
+
tagsMap.set(lowercaseTag, normalizedTag);
|
|
243
|
+
}
|
|
238
244
|
}
|
|
239
|
-
// Extract tags from test
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
// Extract tags from test title (@tag format); only test title is considered
|
|
246
|
+
const titleTagsMatch = test.title.match(/@[A-Za-z0-9_-]+/g) || [];
|
|
247
|
+
titleTagsMatch.forEach(addTag);
|
|
248
|
+
// Extract tags from test.tags (Playwright built-in tags); ignore parents
|
|
249
|
+
if (Array.isArray(test.tags)) {
|
|
250
|
+
test.tags.forEach(addTag);
|
|
245
251
|
}
|
|
246
|
-
return Array.from(
|
|
252
|
+
return Array.from(tagsMap.values());
|
|
247
253
|
}
|
|
248
254
|
/**
|
|
249
255
|
* Returns filename + test title
|
package/package.json
CHANGED
package/src/adapter/jest.js
CHANGED
|
@@ -44,8 +44,7 @@ export class JestReporter {
|
|
|
44
44
|
let steps;
|
|
45
45
|
const { status, title, duration, failureMessages } = result;
|
|
46
46
|
if (failureMessages[0]) {
|
|
47
|
-
|
|
48
|
-
errorMessage = errorMessage.split('\n')[0];
|
|
47
|
+
const errorMessage = failureMessages[0].replace(ansiRegExp(), '');
|
|
49
48
|
error = new Error(errorMessage);
|
|
50
49
|
steps = failureMessages[0];
|
|
51
50
|
}
|
|
@@ -96,7 +96,7 @@ class PlaywrightReporter {
|
|
|
96
96
|
test_id: getTestomatIdFromTestTitle(`${title} ${tags.join(' ')}`),
|
|
97
97
|
suite_title,
|
|
98
98
|
title,
|
|
99
|
-
tags,
|
|
99
|
+
tags: tags.map(tag => tag.replace('@', '')),
|
|
100
100
|
steps: steps.length ? steps : undefined,
|
|
101
101
|
time: duration,
|
|
102
102
|
logs,
|
|
@@ -248,29 +248,35 @@ function generateTmpFilepath(filename = '') {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
|
-
* Extracts
|
|
251
|
+
* Extracts tags from test title, test options, and suite level
|
|
252
|
+
* Identifies duplicate tags (case-insensitive)
|
|
252
253
|
* @param {*} test - testInfo object from Playwright
|
|
253
|
-
* @returns {string[]} - array of normalized tags
|
|
254
|
+
* @returns {string[]} - array of normalized tags with @ prefix
|
|
254
255
|
*/
|
|
255
256
|
function extractTags(test) {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
const tagsMap = new Map(); // key: lowercase tag, value: original case tag
|
|
258
|
+
|
|
259
|
+
function addTag(tag) {
|
|
260
|
+
if (typeof tag !== 'string') return;
|
|
261
|
+
const trimmed = tag.trim();
|
|
262
|
+
if (!trimmed) return;
|
|
263
|
+
const normalizedTag = trimmed.startsWith('@') ? trimmed : `@${trimmed}`;
|
|
264
|
+
const lowercaseTag = normalizedTag.toLowerCase();
|
|
265
|
+
if (!tagsMap.has(lowercaseTag)) {
|
|
266
|
+
tagsMap.set(lowercaseTag, normalizedTag);
|
|
267
|
+
}
|
|
264
268
|
}
|
|
265
269
|
|
|
266
|
-
// Extract tags from test
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
// Extract tags from test title (@tag format); only test title is considered
|
|
271
|
+
const titleTagsMatch = test.title.match(/@[A-Za-z0-9_-]+/g) || [];
|
|
272
|
+
titleTagsMatch.forEach(addTag);
|
|
273
|
+
|
|
274
|
+
// Extract tags from test.tags (Playwright built-in tags); ignore parents
|
|
275
|
+
if (Array.isArray(test.tags)) {
|
|
276
|
+
test.tags.forEach(addTag);
|
|
272
277
|
}
|
|
273
|
-
|
|
278
|
+
|
|
279
|
+
return Array.from(tagsMap.values());
|
|
274
280
|
}
|
|
275
281
|
|
|
276
282
|
/**
|