testomatio-reporter-cli 2.15.0 → 2.16.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/package.json +1 -1
- package/src/adapter/codecept.js +23 -7
- package/src/pipe/testomatio.js +7 -2
package/package.json
CHANGED
package/src/adapter/codecept.js
CHANGED
|
@@ -34,7 +34,8 @@ const HOOK_EXECUTION_ORDER = {
|
|
|
34
34
|
// codeceptjs workers are self-contained
|
|
35
35
|
dataStorage.isFileStorage = false;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// CodeceptJS appends the serialized data row of a data-driven test to its title
|
|
38
|
+
const DATA_REGEXP = / \| (\{.*\}|\[.*\]|null|"(?:\\.|[^"\\])*")((?:\s+@[a-zA-Z0-9-_]+)*)$/;
|
|
38
39
|
|
|
39
40
|
if (MAJOR_VERSION < 3) {
|
|
40
41
|
console.log('🔴 This reporter works with CodeceptJS 3+, please update your tests');
|
|
@@ -349,15 +350,30 @@ function stripExampleFromTitle(title) {
|
|
|
349
350
|
const res = title.match(DATA_REGEXP);
|
|
350
351
|
if (!res) return { title, example: null };
|
|
351
352
|
|
|
353
|
+
let example = null;
|
|
354
|
+
let exampleParsed = false;
|
|
352
355
|
try {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
return { title, example };
|
|
356
|
+
example = JSON.parse(res[1]);
|
|
357
|
+
exampleParsed = true;
|
|
356
358
|
} catch (e) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
359
|
+
try {
|
|
360
|
+
example = JSON.parse(res[1].slice(1, -1));
|
|
361
|
+
exampleParsed = true;
|
|
362
|
+
} catch (e2) {
|
|
363
|
+
debug('Failed to parse example from title:', res[1]);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
let baseTitle = title.slice(0, res.index).trim();
|
|
368
|
+
if (exampleParsed && baseTitle.includes('${current}')) {
|
|
369
|
+
baseTitle = baseTitle.replaceAll('${current}', formatExample(example));
|
|
360
370
|
}
|
|
371
|
+
return { title: `${baseTitle}${res[2]}`, example };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function formatExample(example) {
|
|
375
|
+
if (example !== null && typeof example === 'object') return JSON.stringify(example);
|
|
376
|
+
return String(example);
|
|
361
377
|
}
|
|
362
378
|
|
|
363
379
|
function stripTagsFromTitle(title) {
|
package/src/pipe/testomatio.js
CHANGED
|
@@ -88,12 +88,15 @@ class TestomatioPipe {
|
|
|
88
88
|
this.store = store || {};
|
|
89
89
|
this.title = params.title || process.env.TESTOMATIO_TITLE;
|
|
90
90
|
this.sharedRun = !!process.env.TESTOMATIO_SHARED_RUN;
|
|
91
|
+
this.sharedRunShards = process.env.TESTOMATIO_SHARDS
|
|
92
|
+
? parseInt(process.env.TESTOMATIO_SHARDS, 10) || undefined
|
|
93
|
+
: undefined;
|
|
91
94
|
this.sharedRunTimeout = process.env.TESTOMATIO_SHARED_RUN_TIMEOUT
|
|
92
95
|
? parseInt(process.env.TESTOMATIO_SHARED_RUN_TIMEOUT, 10)
|
|
93
96
|
: undefined;
|
|
94
97
|
|
|
95
|
-
if (this.sharedRunTimeout && !this.sharedRun) {
|
|
96
|
-
debug('Auto-enabling sharedRun because sharedRunTimeout is set');
|
|
98
|
+
if ((this.sharedRunTimeout || this.sharedRunShards) && !this.sharedRun) {
|
|
99
|
+
debug('Auto-enabling sharedRun because sharedRunTimeout or sharedRunShards is set');
|
|
97
100
|
this.sharedRun = true;
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -323,6 +326,7 @@ class TestomatioPipe {
|
|
|
323
326
|
label: this.label,
|
|
324
327
|
shared_run: this.sharedRun,
|
|
325
328
|
shared_run_timeout: this.sharedRunTimeout,
|
|
329
|
+
shared_run_shards: this.sharedRunShards,
|
|
326
330
|
kind: params.kind,
|
|
327
331
|
status: params.status,
|
|
328
332
|
configuration,
|
|
@@ -570,6 +574,7 @@ class TestomatioPipe {
|
|
|
570
574
|
if (status === STATUS.FINISHED) status_event = 'finish';
|
|
571
575
|
if (status === STATUS.PASSED) status_event = 'pass';
|
|
572
576
|
if (status === STATUS.FAILED) status_event = 'fail';
|
|
577
|
+
if (this.sharedRun) status_event = 'finish';
|
|
573
578
|
|
|
574
579
|
try {
|
|
575
580
|
if (this.runId && !this.proceed) {
|