@testomatio/reporter 2.16.0 → 2.17.0-beta
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/codecept.js
CHANGED
|
@@ -36,6 +36,7 @@ const HOOK_EXECUTION_ORDER = {
|
|
|
36
36
|
data_storage_js_1.dataStorage.isFileStorage = false;
|
|
37
37
|
// CodeceptJS appends the serialized data row of a data-driven test to its title
|
|
38
38
|
const DATA_REGEXP = / \| (\{.*\}|\[.*\]|null|"(?:\\.|[^"\\])*")((?:\s+@[a-zA-Z0-9-_]+)*)$/;
|
|
39
|
+
const PLACEHOLDER_REGEXP = /\$\{([\w_]+)\}/g;
|
|
39
40
|
if (MAJOR_VERSION < 3) {
|
|
40
41
|
console.log('🔴 This reporter works with CodeceptJS 3+, please update your tests');
|
|
41
42
|
}
|
|
@@ -315,8 +316,14 @@ function stripExampleFromTitle(title) {
|
|
|
315
316
|
}
|
|
316
317
|
}
|
|
317
318
|
let baseTitle = title.slice(0, res.index).trim();
|
|
318
|
-
if (exampleParsed
|
|
319
|
-
baseTitle = baseTitle.
|
|
319
|
+
if (exampleParsed) {
|
|
320
|
+
baseTitle = baseTitle.replace(PLACEHOLDER_REGEXP, (placeholder, key) => {
|
|
321
|
+
if (key === 'current')
|
|
322
|
+
return formatExample(example);
|
|
323
|
+
if (!Object.hasOwn(example ?? {}, key))
|
|
324
|
+
return placeholder;
|
|
325
|
+
return formatExample(example[key]);
|
|
326
|
+
});
|
|
320
327
|
}
|
|
321
328
|
return { title: `${baseTitle}${res[2]}`, example };
|
|
322
329
|
}
|
package/package.json
CHANGED
package/src/adapter/codecept.js
CHANGED
|
@@ -36,6 +36,7 @@ dataStorage.isFileStorage = false;
|
|
|
36
36
|
|
|
37
37
|
// CodeceptJS appends the serialized data row of a data-driven test to its title
|
|
38
38
|
const DATA_REGEXP = / \| (\{.*\}|\[.*\]|null|"(?:\\.|[^"\\])*")((?:\s+@[a-zA-Z0-9-_]+)*)$/;
|
|
39
|
+
const PLACEHOLDER_REGEXP = /\$\{([\w_]+)\}/g;
|
|
39
40
|
|
|
40
41
|
if (MAJOR_VERSION < 3) {
|
|
41
42
|
console.log('🔴 This reporter works with CodeceptJS 3+, please update your tests');
|
|
@@ -365,8 +366,12 @@ function stripExampleFromTitle(title) {
|
|
|
365
366
|
}
|
|
366
367
|
|
|
367
368
|
let baseTitle = title.slice(0, res.index).trim();
|
|
368
|
-
if (exampleParsed
|
|
369
|
-
baseTitle = baseTitle.
|
|
369
|
+
if (exampleParsed) {
|
|
370
|
+
baseTitle = baseTitle.replace(PLACEHOLDER_REGEXP, (placeholder, key) => {
|
|
371
|
+
if (key === 'current') return formatExample(example);
|
|
372
|
+
if (!Object.hasOwn(example ?? {}, key)) return placeholder;
|
|
373
|
+
return formatExample(example[key]);
|
|
374
|
+
});
|
|
370
375
|
}
|
|
371
376
|
return { title: `${baseTitle}${res[2]}`, example };
|
|
372
377
|
}
|