@testomatio/reporter 2.13.0 → 2.14.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/allureReader.d.ts +19 -1
- package/lib/allureReader.js +64 -22
- package/lib/bin/cli.js +2 -2
- package/lib/pipe/html.d.ts +1 -0
- package/lib/pipe/html.js +12 -10
- package/lib/xmlReader.js +4 -2
- package/package.json +2 -2
- package/src/allureReader.js +70 -24
- package/src/bin/cli.js +2 -2
- package/src/pipe/html.js +13 -10
- package/src/xmlReader.js +4 -2
- package/types/types.d.ts +2 -2
package/lib/allureReader.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ declare class AllureReader {
|
|
|
139
139
|
* @returns {string|null}
|
|
140
140
|
*/
|
|
141
141
|
extractTmsIdFromSource(contents: string, test: object): string | null;
|
|
142
|
-
convertSteps(steps: any, depth?: number): any;
|
|
142
|
+
convertSteps(steps: any, resultsDir?: string, depth?: number): any;
|
|
143
143
|
/**
|
|
144
144
|
* Check whether any step in the given (already converted) subtree already
|
|
145
145
|
* carries an `error`. Used to keep the failure message on the deepest failed
|
|
@@ -211,6 +211,24 @@ declare class AllureReader {
|
|
|
211
211
|
* @returns {string[]}
|
|
212
212
|
*/
|
|
213
213
|
sourceCandidatesForTest(t: object, index: Map<string, string[]>): string[];
|
|
214
|
+
/**
|
|
215
|
+
* @param {Array<{source?: string}>|undefined} attachments
|
|
216
|
+
* @param {string} resultsDir
|
|
217
|
+
* @returns {string[]} paths of attachments that exist on disk
|
|
218
|
+
*/
|
|
219
|
+
resolveAttachments(attachments: Array<{
|
|
220
|
+
source?: string;
|
|
221
|
+
}> | undefined, resultsDir: string): string[];
|
|
222
|
+
/**
|
|
223
|
+
* Replaces step artifact paths with S3 links, dropping failed uploads (a local path
|
|
224
|
+
* would be a dead link in the UI).
|
|
225
|
+
*
|
|
226
|
+
* @param {Array<object>|undefined} steps
|
|
227
|
+
* @param {string} runId
|
|
228
|
+
* @param {string} rid
|
|
229
|
+
* @returns {Promise<number>} number of uploaded step artifacts
|
|
230
|
+
*/
|
|
231
|
+
uploadStepArtifacts(steps: Array<object> | undefined, runId: string, rid: string): Promise<number>;
|
|
214
232
|
uploadArtifacts(): Promise<void>;
|
|
215
233
|
uploadData(): Promise<any[]>;
|
|
216
234
|
}
|
package/lib/allureReader.js
CHANGED
|
@@ -160,7 +160,7 @@ class AllureReader {
|
|
|
160
160
|
suite_title: this.extractSuiteTitle(result),
|
|
161
161
|
file: this.extractFile(result),
|
|
162
162
|
run_time: this.calculateRunTime(result),
|
|
163
|
-
steps: this.convertSteps(result.steps || []),
|
|
163
|
+
steps: this.convertSteps(result.steps || [], resultsDir),
|
|
164
164
|
message: result.statusDetails?.message || '',
|
|
165
165
|
stack: result.statusDetails?.trace || '',
|
|
166
166
|
meta: this.extractMeta(result),
|
|
@@ -182,20 +182,9 @@ class AllureReader {
|
|
|
182
182
|
if (result.parameters && result.parameters.length > 0) {
|
|
183
183
|
test.example = this.convertParameters(result.parameters);
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const fullPath = path_1.default.join(resultsDir, att.source);
|
|
189
|
-
if (fs_1.default.existsSync(fullPath)) {
|
|
190
|
-
return fullPath;
|
|
191
|
-
}
|
|
192
|
-
debug('Attachment file not found:', fullPath);
|
|
193
|
-
return null;
|
|
194
|
-
})
|
|
195
|
-
.filter(Boolean);
|
|
196
|
-
if (attachments.length > 0) {
|
|
197
|
-
test.files = attachments;
|
|
198
|
-
}
|
|
185
|
+
const attachments = this.resolveAttachments(result.attachments, resultsDir);
|
|
186
|
+
if (attachments.length > 0) {
|
|
187
|
+
test.files = attachments;
|
|
199
188
|
}
|
|
200
189
|
return test;
|
|
201
190
|
}
|
|
@@ -479,7 +468,7 @@ class AllureReader {
|
|
|
479
468
|
extractTmsIdFromSource(contents, test) {
|
|
480
469
|
return this.extractTmsIdsFromSource(contents, test)[0] || null;
|
|
481
470
|
}
|
|
482
|
-
convertSteps(steps, depth = 0) {
|
|
471
|
+
convertSteps(steps, resultsDir = '', depth = 0) {
|
|
483
472
|
if (depth >= 10)
|
|
484
473
|
return null;
|
|
485
474
|
return steps
|
|
@@ -489,8 +478,13 @@ class AllureReader {
|
|
|
489
478
|
title: step.name || step.title || 'Unknown step',
|
|
490
479
|
status: this.mapStepStatus(step.status),
|
|
491
480
|
duration: this.calculateRunTime(step),
|
|
492
|
-
steps: this.convertSteps(step.steps || [], depth + 1),
|
|
481
|
+
steps: this.convertSteps(step.steps || [], resultsDir, depth + 1),
|
|
493
482
|
};
|
|
483
|
+
// step attachments stay on the step; uploadArtifacts() swaps the paths for links
|
|
484
|
+
const attachments = this.resolveAttachments(step.attachments, resultsDir);
|
|
485
|
+
if (attachments.length > 0) {
|
|
486
|
+
convertedStep.artifacts = attachments;
|
|
487
|
+
}
|
|
494
488
|
// Attach the failure description (error message + trace with the failing
|
|
495
489
|
// code line) straight onto the failed step. Testomat.io renders a step's
|
|
496
490
|
// `error` inline in the step tree, so the failure shows up on the exact
|
|
@@ -798,14 +792,62 @@ class AllureReader {
|
|
|
798
792
|
}
|
|
799
793
|
return paths;
|
|
800
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* @param {Array<{source?: string}>|undefined} attachments
|
|
797
|
+
* @param {string} resultsDir
|
|
798
|
+
* @returns {string[]} paths of attachments that exist on disk
|
|
799
|
+
*/
|
|
800
|
+
resolveAttachments(attachments, resultsDir) {
|
|
801
|
+
if (!attachments || !attachments.length)
|
|
802
|
+
return [];
|
|
803
|
+
return attachments
|
|
804
|
+
.map(att => {
|
|
805
|
+
if (!att?.source)
|
|
806
|
+
return null;
|
|
807
|
+
const fullPath = path_1.default.join(resultsDir || '', att.source);
|
|
808
|
+
if (fs_1.default.existsSync(fullPath))
|
|
809
|
+
return fullPath;
|
|
810
|
+
debug('Attachment file not found:', fullPath);
|
|
811
|
+
return null;
|
|
812
|
+
})
|
|
813
|
+
.filter(Boolean);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Replaces step artifact paths with S3 links, dropping failed uploads (a local path
|
|
817
|
+
* would be a dead link in the UI).
|
|
818
|
+
*
|
|
819
|
+
* @param {Array<object>|undefined} steps
|
|
820
|
+
* @param {string} runId
|
|
821
|
+
* @param {string} rid
|
|
822
|
+
* @returns {Promise<number>} number of uploaded step artifacts
|
|
823
|
+
*/
|
|
824
|
+
async uploadStepArtifacts(steps, runId, rid) {
|
|
825
|
+
if (!steps || !steps.length)
|
|
826
|
+
return 0;
|
|
827
|
+
let uploaded = 0;
|
|
828
|
+
for (const step of steps) {
|
|
829
|
+
if (step.artifacts?.length) {
|
|
830
|
+
const links = await Promise.all(step.artifacts.map(f => this.uploader.uploadFileByPath(f, [runId, rid, 'steps', path_1.default.basename(f)])));
|
|
831
|
+
step.artifacts = links.filter(link => !!link);
|
|
832
|
+
uploaded += step.artifacts.length;
|
|
833
|
+
if (!step.artifacts.length)
|
|
834
|
+
delete step.artifacts;
|
|
835
|
+
}
|
|
836
|
+
uploaded += await this.uploadStepArtifacts(step.steps, runId, rid);
|
|
837
|
+
}
|
|
838
|
+
return uploaded;
|
|
839
|
+
}
|
|
801
840
|
async uploadArtifacts() {
|
|
802
|
-
for (const test of this._tests
|
|
841
|
+
for (const test of this._tests) {
|
|
803
842
|
const runId = this.runId || this.store.runId || Date.now().toString();
|
|
804
|
-
|
|
805
|
-
|
|
843
|
+
// uploadFileByPath resolves to a link string, or undefined if skipped or failed
|
|
844
|
+
const links = await Promise.all((test.files || []).map(f => this.uploader.uploadFileByPath(f, [runId, test.rid, path_1.default.basename(f)])));
|
|
845
|
+
test.artifacts = links.filter(link => !!link);
|
|
806
846
|
delete test.files;
|
|
807
|
-
|
|
808
|
-
|
|
847
|
+
const stepArtifacts = await this.uploadStepArtifacts(test.steps, runId, test.rid);
|
|
848
|
+
const total = test.artifacts.length + stepArtifacts;
|
|
849
|
+
if (total > 0) {
|
|
850
|
+
console.log(constants_js_1.APP_PREFIX, `🗄️ Uploaded ${picocolors_1.default.bold(`${total} artifacts`)} for test ${test.title}`);
|
|
809
851
|
}
|
|
810
852
|
}
|
|
811
853
|
}
|
package/lib/bin/cli.js
CHANGED
|
@@ -53,7 +53,7 @@ program
|
|
|
53
53
|
program
|
|
54
54
|
.command('start')
|
|
55
55
|
.description('Start a new run and return its ID')
|
|
56
|
-
.option('--kind <type>', 'Specify run type: automated, manual, or
|
|
56
|
+
.option('--kind <type>', 'Specify run type: automated, manual, mixed, or detect')
|
|
57
57
|
.option('--filter <filter>', 'Scope the prepared run to tests matching the filter (no execution)')
|
|
58
58
|
.option('--format <format>', 'Machine-readable output: print only the run id to stdout (e.g. --format id)')
|
|
59
59
|
.option('--warn', 'Exit 0 instead of 1 when the filter matches no tests (warn only)')
|
|
@@ -121,7 +121,7 @@ program
|
|
|
121
121
|
.option('--filter <filter>', 'Additional execution filter')
|
|
122
122
|
.option('--filter-list <filter>', 'Get a list of all tests by filter before running')
|
|
123
123
|
.option('--format <format>', 'Machine-readable output format for --filter-list (grep, json, newline, ids)')
|
|
124
|
-
.option('--kind <type>', 'Specify run type: automated, manual, or
|
|
124
|
+
.option('--kind <type>', 'Specify run type: automated, manual, mixed, or detect')
|
|
125
125
|
.option('--remote <profile>', 'Trigger run on the named Testomat.io CI profile instead of executing locally')
|
|
126
126
|
.option('--remote-param <kv>', 'key=value pair forwarded to the CI profile config (repeat for multiple)', (value, prev) => prev.concat([value]), [])
|
|
127
127
|
.option('--warn', 'Exit 0 instead of 1 when the filter matches no tests (warn only)')
|
package/lib/pipe/html.d.ts
CHANGED
package/lib/pipe/html.js
CHANGED
|
@@ -31,6 +31,7 @@ class HtmlPipe {
|
|
|
31
31
|
this.filenameMsg = '';
|
|
32
32
|
this.tests = [];
|
|
33
33
|
this.configuration = null;
|
|
34
|
+
this.startedAt = null;
|
|
34
35
|
if (this.isHtml) {
|
|
35
36
|
this.isEnabled = true;
|
|
36
37
|
this.htmlReportDir = params.reportDir || process.env.TESTOMATIO_HTML_REPORT_FOLDER || constants_js_1.HTML_REPORT.FOLDER;
|
|
@@ -58,6 +59,7 @@ class HtmlPipe {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
async createRun(params = {}) {
|
|
62
|
+
this.startedAt ??= new Date();
|
|
61
63
|
if (params?.configuration && typeof params.configuration === 'object') {
|
|
62
64
|
this.configuration = { ...(this.configuration || {}), ...params.configuration };
|
|
63
65
|
}
|
|
@@ -215,7 +217,7 @@ class HtmlPipe {
|
|
|
215
217
|
parallel: runParams.isParallel || 'No parallel info',
|
|
216
218
|
runUrl: this.store.runUrl || '',
|
|
217
219
|
executionTime: testExecutionSumTime(aggregatedTests),
|
|
218
|
-
executionDate:
|
|
220
|
+
executionDate: getDateTimeFormatted(this.startedAt || new Date()),
|
|
219
221
|
description: [this.description, runParams.description || this.store.coverageDescription || this.store.description]
|
|
220
222
|
.filter(Boolean)
|
|
221
223
|
.join('\n\n') || '',
|
|
@@ -599,17 +601,17 @@ function formatDuration(duration) {
|
|
|
599
601
|
return `${hours}h ${minutes}m ${seconds}s ${milliseconds}ms`;
|
|
600
602
|
}
|
|
601
603
|
/**
|
|
602
|
-
*
|
|
604
|
+
* Formats a date and time for display in the report.
|
|
605
|
+
* @param {Date} date - Date and time to format.
|
|
603
606
|
* @returns {string} - The formatted date and time string (e.g., "(01/01/2023 12:00:00)").
|
|
604
607
|
*/
|
|
605
|
-
function
|
|
606
|
-
const
|
|
607
|
-
const
|
|
608
|
-
const
|
|
609
|
-
const
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
|
|
608
|
+
function getDateTimeFormatted(date) {
|
|
609
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
610
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
611
|
+
const year = date.getFullYear();
|
|
612
|
+
const hours = date.getHours().toString().padStart(2, '0');
|
|
613
|
+
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
614
|
+
const seconds = date.getSeconds().toString().padStart(2, '0');
|
|
613
615
|
return `(${day}/${month}/${year} ${hours}:${minutes}:${seconds})`;
|
|
614
616
|
}
|
|
615
617
|
/**
|
package/lib/xmlReader.js
CHANGED
|
@@ -459,8 +459,10 @@ class XmlReader {
|
|
|
459
459
|
if (!files.length)
|
|
460
460
|
continue;
|
|
461
461
|
const runId = this.runId || this.store.runId || Date.now().toString();
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
// undefined for skipped/failed uploads; keeping those serializes as `null` links
|
|
463
|
+
const links = await Promise.all(files.map(f => this.uploader.uploadFileByPath(f, [runId, path_1.default.basename(f)])));
|
|
464
|
+
test.artifacts = links.filter(link => !!link);
|
|
465
|
+
log_js_1.log.info(`🗄️ Uploaded ${picocolors_1.default.bold(`${test.artifacts.length} artifacts`)} for test ${test.title}`);
|
|
464
466
|
}
|
|
465
467
|
}
|
|
466
468
|
async createRun() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/cross-spawn": "^6.0.6",
|
|
92
92
|
"@types/cucumber": "^7.0.0",
|
|
93
93
|
"@types/mocha": "^10.0.7",
|
|
94
|
-
"@wdio/reporter": "^
|
|
94
|
+
"@wdio/reporter": "^8.43.0",
|
|
95
95
|
"chai": "^4.3.6",
|
|
96
96
|
"codeceptjs": "^3.6.5",
|
|
97
97
|
"cucumber": "^6.0.7",
|
package/src/allureReader.js
CHANGED
|
@@ -183,7 +183,7 @@ class AllureReader {
|
|
|
183
183
|
suite_title: this.extractSuiteTitle(result),
|
|
184
184
|
file: this.extractFile(result),
|
|
185
185
|
run_time: this.calculateRunTime(result),
|
|
186
|
-
steps: this.convertSteps(result.steps || []),
|
|
186
|
+
steps: this.convertSteps(result.steps || [], resultsDir),
|
|
187
187
|
message: result.statusDetails?.message || '',
|
|
188
188
|
stack: result.statusDetails?.trace || '',
|
|
189
189
|
meta: this.extractMeta(result),
|
|
@@ -209,21 +209,9 @@ class AllureReader {
|
|
|
209
209
|
test.example = this.convertParameters(result.parameters);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const fullPath = path.join(resultsDir, att.source);
|
|
216
|
-
if (fs.existsSync(fullPath)) {
|
|
217
|
-
return fullPath;
|
|
218
|
-
}
|
|
219
|
-
debug('Attachment file not found:', fullPath);
|
|
220
|
-
return null;
|
|
221
|
-
})
|
|
222
|
-
.filter(Boolean);
|
|
223
|
-
|
|
224
|
-
if (attachments.length > 0) {
|
|
225
|
-
test.files = attachments;
|
|
226
|
-
}
|
|
212
|
+
const attachments = this.resolveAttachments(result.attachments, resultsDir);
|
|
213
|
+
if (attachments.length > 0) {
|
|
214
|
+
test.files = attachments;
|
|
227
215
|
}
|
|
228
216
|
|
|
229
217
|
return test;
|
|
@@ -531,7 +519,7 @@ class AllureReader {
|
|
|
531
519
|
return this.extractTmsIdsFromSource(contents, test)[0] || null;
|
|
532
520
|
}
|
|
533
521
|
|
|
534
|
-
convertSteps(steps, depth = 0) {
|
|
522
|
+
convertSteps(steps, resultsDir = '', depth = 0) {
|
|
535
523
|
if (depth >= 10) return null;
|
|
536
524
|
|
|
537
525
|
return steps
|
|
@@ -541,9 +529,15 @@ class AllureReader {
|
|
|
541
529
|
title: step.name || step.title || 'Unknown step',
|
|
542
530
|
status: this.mapStepStatus(step.status),
|
|
543
531
|
duration: this.calculateRunTime(step),
|
|
544
|
-
steps: this.convertSteps(step.steps || [], depth + 1),
|
|
532
|
+
steps: this.convertSteps(step.steps || [], resultsDir, depth + 1),
|
|
545
533
|
};
|
|
546
534
|
|
|
535
|
+
// step attachments stay on the step; uploadArtifacts() swaps the paths for links
|
|
536
|
+
const attachments = this.resolveAttachments(step.attachments, resultsDir);
|
|
537
|
+
if (attachments.length > 0) {
|
|
538
|
+
convertedStep.artifacts = attachments;
|
|
539
|
+
}
|
|
540
|
+
|
|
547
541
|
// Attach the failure description (error message + trace with the failing
|
|
548
542
|
// code line) straight onto the failed step. Testomat.io renders a step's
|
|
549
543
|
// `error` inline in the step tree, so the failure shows up on the exact
|
|
@@ -876,16 +870,68 @@ class AllureReader {
|
|
|
876
870
|
return paths;
|
|
877
871
|
}
|
|
878
872
|
|
|
873
|
+
/**
|
|
874
|
+
* @param {Array<{source?: string}>|undefined} attachments
|
|
875
|
+
* @param {string} resultsDir
|
|
876
|
+
* @returns {string[]} paths of attachments that exist on disk
|
|
877
|
+
*/
|
|
878
|
+
resolveAttachments(attachments, resultsDir) {
|
|
879
|
+
if (!attachments || !attachments.length) return [];
|
|
880
|
+
|
|
881
|
+
return attachments
|
|
882
|
+
.map(att => {
|
|
883
|
+
if (!att?.source) return null;
|
|
884
|
+
const fullPath = path.join(resultsDir || '', att.source);
|
|
885
|
+
if (fs.existsSync(fullPath)) return fullPath;
|
|
886
|
+
debug('Attachment file not found:', fullPath);
|
|
887
|
+
return null;
|
|
888
|
+
})
|
|
889
|
+
.filter(Boolean);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Replaces step artifact paths with S3 links, dropping failed uploads (a local path
|
|
894
|
+
* would be a dead link in the UI).
|
|
895
|
+
*
|
|
896
|
+
* @param {Array<object>|undefined} steps
|
|
897
|
+
* @param {string} runId
|
|
898
|
+
* @param {string} rid
|
|
899
|
+
* @returns {Promise<number>} number of uploaded step artifacts
|
|
900
|
+
*/
|
|
901
|
+
async uploadStepArtifacts(steps, runId, rid) {
|
|
902
|
+
if (!steps || !steps.length) return 0;
|
|
903
|
+
|
|
904
|
+
let uploaded = 0;
|
|
905
|
+
for (const step of steps) {
|
|
906
|
+
if (step.artifacts?.length) {
|
|
907
|
+
const links = await Promise.all(
|
|
908
|
+
step.artifacts.map(f => this.uploader.uploadFileByPath(f, [runId, rid, 'steps', path.basename(f)])),
|
|
909
|
+
);
|
|
910
|
+
step.artifacts = links.filter(link => !!link);
|
|
911
|
+
uploaded += step.artifacts.length;
|
|
912
|
+
if (!step.artifacts.length) delete step.artifacts;
|
|
913
|
+
}
|
|
914
|
+
uploaded += await this.uploadStepArtifacts(step.steps, runId, rid);
|
|
915
|
+
}
|
|
916
|
+
return uploaded;
|
|
917
|
+
}
|
|
918
|
+
|
|
879
919
|
async uploadArtifacts() {
|
|
880
|
-
for (const test of this._tests
|
|
920
|
+
for (const test of this._tests) {
|
|
881
921
|
const runId = this.runId || this.store.runId || Date.now().toString();
|
|
882
|
-
|
|
883
|
-
|
|
922
|
+
|
|
923
|
+
// uploadFileByPath resolves to a link string, or undefined if skipped or failed
|
|
924
|
+
const links = await Promise.all(
|
|
925
|
+
(test.files || []).map(f => this.uploader.uploadFileByPath(f, [runId, test.rid, path.basename(f)])),
|
|
884
926
|
);
|
|
885
|
-
test.artifacts =
|
|
927
|
+
test.artifacts = links.filter(link => !!link);
|
|
886
928
|
delete test.files;
|
|
887
|
-
|
|
888
|
-
|
|
929
|
+
|
|
930
|
+
const stepArtifacts = await this.uploadStepArtifacts(test.steps, runId, test.rid);
|
|
931
|
+
|
|
932
|
+
const total = test.artifacts.length + stepArtifacts;
|
|
933
|
+
if (total > 0) {
|
|
934
|
+
console.log(APP_PREFIX, `🗄️ Uploaded ${pc.bold(`${total} artifacts`)} for test ${test.title}`);
|
|
889
935
|
}
|
|
890
936
|
}
|
|
891
937
|
}
|
package/src/bin/cli.js
CHANGED
|
@@ -51,7 +51,7 @@ program
|
|
|
51
51
|
program
|
|
52
52
|
.command('start')
|
|
53
53
|
.description('Start a new run and return its ID')
|
|
54
|
-
.option('--kind <type>', 'Specify run type: automated, manual, or
|
|
54
|
+
.option('--kind <type>', 'Specify run type: automated, manual, mixed, or detect')
|
|
55
55
|
.option('--filter <filter>', 'Scope the prepared run to tests matching the filter (no execution)')
|
|
56
56
|
.option('--format <format>', 'Machine-readable output: print only the run id to stdout (e.g. --format id)')
|
|
57
57
|
.option('--warn', 'Exit 0 instead of 1 when the filter matches no tests (warn only)')
|
|
@@ -130,7 +130,7 @@ program
|
|
|
130
130
|
.option('--filter <filter>', 'Additional execution filter')
|
|
131
131
|
.option('--filter-list <filter>', 'Get a list of all tests by filter before running')
|
|
132
132
|
.option('--format <format>', 'Machine-readable output format for --filter-list (grep, json, newline, ids)')
|
|
133
|
-
.option('--kind <type>', 'Specify run type: automated, manual, or
|
|
133
|
+
.option('--kind <type>', 'Specify run type: automated, manual, mixed, or detect')
|
|
134
134
|
.option('--remote <profile>', 'Trigger run on the named Testomat.io CI profile instead of executing locally')
|
|
135
135
|
.option(
|
|
136
136
|
'--remote-param <kv>',
|
package/src/pipe/html.js
CHANGED
|
@@ -32,6 +32,7 @@ class HtmlPipe {
|
|
|
32
32
|
this.filenameMsg = '';
|
|
33
33
|
this.tests = [];
|
|
34
34
|
this.configuration = null;
|
|
35
|
+
this.startedAt = null;
|
|
35
36
|
|
|
36
37
|
if (this.isHtml) {
|
|
37
38
|
this.isEnabled = true;
|
|
@@ -70,6 +71,8 @@ class HtmlPipe {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
async createRun(params = {}) {
|
|
74
|
+
this.startedAt ??= new Date();
|
|
75
|
+
|
|
73
76
|
if (params?.configuration && typeof params.configuration === 'object') {
|
|
74
77
|
this.configuration = { ...(this.configuration || {}), ...params.configuration };
|
|
75
78
|
}
|
|
@@ -266,7 +269,7 @@ class HtmlPipe {
|
|
|
266
269
|
parallel: runParams.isParallel || 'No parallel info',
|
|
267
270
|
runUrl: this.store.runUrl || '',
|
|
268
271
|
executionTime: testExecutionSumTime(aggregatedTests),
|
|
269
|
-
executionDate:
|
|
272
|
+
executionDate: getDateTimeFormatted(this.startedAt || new Date()),
|
|
270
273
|
description:
|
|
271
274
|
[this.description, runParams.description || this.store.coverageDescription || this.store.description]
|
|
272
275
|
.filter(Boolean)
|
|
@@ -722,17 +725,17 @@ function formatDuration(duration) {
|
|
|
722
725
|
}
|
|
723
726
|
|
|
724
727
|
/**
|
|
725
|
-
*
|
|
728
|
+
* Formats a date and time for display in the report.
|
|
729
|
+
* @param {Date} date - Date and time to format.
|
|
726
730
|
* @returns {string} - The formatted date and time string (e.g., "(01/01/2023 12:00:00)").
|
|
727
731
|
*/
|
|
728
|
-
function
|
|
729
|
-
const
|
|
730
|
-
const
|
|
731
|
-
const
|
|
732
|
-
const
|
|
733
|
-
const
|
|
734
|
-
const
|
|
735
|
-
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
|
|
732
|
+
function getDateTimeFormatted(date) {
|
|
733
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
734
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
735
|
+
const year = date.getFullYear();
|
|
736
|
+
const hours = date.getHours().toString().padStart(2, '0');
|
|
737
|
+
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
738
|
+
const seconds = date.getSeconds().toString().padStart(2, '0');
|
|
736
739
|
|
|
737
740
|
return `(${day}/${month}/${year} ${hours}:${minutes}:${seconds})`;
|
|
738
741
|
}
|
package/src/xmlReader.js
CHANGED
|
@@ -533,8 +533,10 @@ class XmlReader {
|
|
|
533
533
|
if (!files.length) continue;
|
|
534
534
|
|
|
535
535
|
const runId = this.runId || this.store.runId || Date.now().toString();
|
|
536
|
-
|
|
537
|
-
|
|
536
|
+
// undefined for skipped/failed uploads; keeping those serializes as `null` links
|
|
537
|
+
const links = await Promise.all(files.map(f => this.uploader.uploadFileByPath(f, [runId, path.basename(f)])));
|
|
538
|
+
test.artifacts = links.filter(link => !!link);
|
|
539
|
+
log.info(`🗄️ Uploaded ${pc.bold(`${test.artifacts.length} artifacts`)} for test ${test.title}`);
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
|
package/types/types.d.ts
CHANGED
|
@@ -337,8 +337,8 @@ export interface PipeResult {
|
|
|
337
337
|
* `TESTOMATIO_CI_PROFILE` and `TESTOMATIO_CI_OVERRIDE`.
|
|
338
338
|
*/
|
|
339
339
|
export interface CreateRunParams {
|
|
340
|
-
/** Run kind. Defaults to `automated` server-side. */
|
|
341
|
-
kind?: 'automated' | 'manual' | 'mixed';
|
|
340
|
+
/** Run kind. Defaults to `automated` server-side. `detect` resolves to one of the other three from the scoped tests. */
|
|
341
|
+
kind?: 'automated' | 'manual' | 'mixed' | 'detect';
|
|
342
342
|
|
|
343
343
|
/** Run title. */
|
|
344
344
|
title?: string;
|