@testomatio/reporter 2.7.9-beta.3-markdown → 2.8.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/lib/client.js +16 -30
- package/package.json +1 -1
- package/src/client.js +13 -26
package/lib/client.js
CHANGED
|
@@ -214,9 +214,10 @@ class Client {
|
|
|
214
214
|
const { time = 0, example = null, filesBuffers = [], code = null, file, suite_id, test_id, timestamp, links, overwrite, tags, } = testData;
|
|
215
215
|
let { files = [], manuallyAttachedArtifacts, message = '', meta = {} } = testData;
|
|
216
216
|
if (stepArtifactPaths.size) {
|
|
217
|
-
|
|
217
|
+
const isStepArtifact = item => stepArtifactPaths.has(typeof item === 'object' ? item?.path : item);
|
|
218
|
+
files = files.filter(f => !isStepArtifact(f));
|
|
218
219
|
if (Array.isArray(manuallyAttachedArtifacts)) {
|
|
219
|
-
manuallyAttachedArtifacts = manuallyAttachedArtifacts.filter(a => !isStepArtifact(a
|
|
220
|
+
manuallyAttachedArtifacts = manuallyAttachedArtifacts.filter(a => !isStepArtifact(a));
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
meta = Object.entries(meta)
|
|
@@ -385,42 +386,27 @@ exports.Client = Client;
|
|
|
385
386
|
* referenced by `step.artifacts` at any depth.
|
|
386
387
|
*
|
|
387
388
|
* @param {any} steps
|
|
389
|
+
* @param {Set<string>} [paths]
|
|
388
390
|
* @returns {Set<string>}
|
|
389
391
|
*/
|
|
390
|
-
function collectStepArtifactPaths(steps) {
|
|
391
|
-
const paths = new Set();
|
|
392
|
+
function collectStepArtifactPaths(steps, paths = new Set()) {
|
|
392
393
|
if (!Array.isArray(steps))
|
|
393
394
|
return paths;
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
paths.add(a.path);
|
|
404
|
-
}
|
|
395
|
+
for (const step of steps) {
|
|
396
|
+
if (!step)
|
|
397
|
+
continue;
|
|
398
|
+
if (Array.isArray(step.artifacts)) {
|
|
399
|
+
for (const a of step.artifacts) {
|
|
400
|
+
if (typeof a === 'string')
|
|
401
|
+
paths.add(a);
|
|
402
|
+
else if (a && typeof a === 'object' && typeof a.path === 'string')
|
|
403
|
+
paths.add(a.path);
|
|
405
404
|
}
|
|
406
|
-
if (Array.isArray(step.steps))
|
|
407
|
-
walk(step.steps);
|
|
408
405
|
}
|
|
409
|
-
|
|
410
|
-
|
|
406
|
+
collectStepArtifactPaths(step.steps, paths);
|
|
407
|
+
}
|
|
411
408
|
return paths;
|
|
412
409
|
}
|
|
413
|
-
/**
|
|
414
|
-
* @param {string|{path?: string}|null|undefined} item
|
|
415
|
-
* @param {Set<string>} paths
|
|
416
|
-
* @returns {boolean}
|
|
417
|
-
*/
|
|
418
|
-
function isStepArtifact(item, paths) {
|
|
419
|
-
if (!item)
|
|
420
|
-
return false;
|
|
421
|
-
const p = typeof item === 'object' ? item.path : item;
|
|
422
|
-
return typeof p === 'string' && paths.has(p);
|
|
423
|
-
}
|
|
424
410
|
/**
|
|
425
411
|
*
|
|
426
412
|
* @param {TestData} testData
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -245,9 +245,10 @@ class Client {
|
|
|
245
245
|
let { files = [], manuallyAttachedArtifacts, message = '', meta = {} } = testData;
|
|
246
246
|
|
|
247
247
|
if (stepArtifactPaths.size) {
|
|
248
|
-
|
|
248
|
+
const isStepArtifact = item => stepArtifactPaths.has(typeof item === 'object' ? item?.path : item);
|
|
249
|
+
files = files.filter(f => !isStepArtifact(f));
|
|
249
250
|
if (Array.isArray(manuallyAttachedArtifacts)) {
|
|
250
|
-
manuallyAttachedArtifacts = manuallyAttachedArtifacts.filter(a => !isStepArtifact(a
|
|
251
|
+
manuallyAttachedArtifacts = manuallyAttachedArtifacts.filter(a => !isStepArtifact(a));
|
|
251
252
|
}
|
|
252
253
|
}
|
|
253
254
|
|
|
@@ -464,38 +465,24 @@ class Client {
|
|
|
464
465
|
* referenced by `step.artifacts` at any depth.
|
|
465
466
|
*
|
|
466
467
|
* @param {any} steps
|
|
468
|
+
* @param {Set<string>} [paths]
|
|
467
469
|
* @returns {Set<string>}
|
|
468
470
|
*/
|
|
469
|
-
function collectStepArtifactPaths(steps) {
|
|
470
|
-
const paths = new Set();
|
|
471
|
+
function collectStepArtifactPaths(steps, paths = new Set()) {
|
|
471
472
|
if (!Array.isArray(steps)) return paths;
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
else if (a && typeof a === 'object' && typeof a.path === 'string') paths.add(a.path);
|
|
479
|
-
}
|
|
473
|
+
for (const step of steps) {
|
|
474
|
+
if (!step) continue;
|
|
475
|
+
if (Array.isArray(step.artifacts)) {
|
|
476
|
+
for (const a of step.artifacts) {
|
|
477
|
+
if (typeof a === 'string') paths.add(a);
|
|
478
|
+
else if (a && typeof a === 'object' && typeof a.path === 'string') paths.add(a.path);
|
|
480
479
|
}
|
|
481
|
-
if (Array.isArray(step.steps)) walk(step.steps);
|
|
482
480
|
}
|
|
483
|
-
|
|
484
|
-
|
|
481
|
+
collectStepArtifactPaths(step.steps, paths);
|
|
482
|
+
}
|
|
485
483
|
return paths;
|
|
486
484
|
}
|
|
487
485
|
|
|
488
|
-
/**
|
|
489
|
-
* @param {string|{path?: string}|null|undefined} item
|
|
490
|
-
* @param {Set<string>} paths
|
|
491
|
-
* @returns {boolean}
|
|
492
|
-
*/
|
|
493
|
-
function isStepArtifact(item, paths) {
|
|
494
|
-
if (!item) return false;
|
|
495
|
-
const p = typeof item === 'object' ? item.path : item;
|
|
496
|
-
return typeof p === 'string' && paths.has(p);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
486
|
/**
|
|
500
487
|
*
|
|
501
488
|
* @param {TestData} testData
|