@testomatio/reporter 2.3.7-beta.9-stack-artifacts β 2.3.7-rc.1
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/README.md +1 -1
- package/lib/bin/cli.js +13 -3
- package/lib/bin/startTest.js +3 -3
- package/lib/client.d.ts +1 -1
- package/lib/client.js +8 -8
- package/lib/pipe/testomatio.d.ts +2 -1
- package/lib/pipe/testomatio.js +3 -2
- package/lib/template/testomatio.hbs +1366 -1026
- package/package.json +8 -4
- package/src/bin/cli.js +1 -1
- package/src/bin/reportXml.js +5 -2
- package/src/bin/startTest.js +5 -5
- package/src/client.js +8 -8
- package/src/junit-adapter/csharp.js +45 -6
- package/src/junit-adapter/nunit-parser.js +462 -0
- package/src/pipe/testomatio.js +1 -1
- package/src/template/testomatio.hbs +1366 -1026
- package/src/uploader.js +5 -0
- package/src/utils/utils.js +206 -19
- package/src/xmlReader.js +131 -45
- package/types/types.d.ts +364 -0
- package/types/vitest.types.d.ts +93 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Testomat.io Reporter (this npm package) supports:
|
|
|
13
13
|
- π [Stack traces](./docs/stacktrace.md) and error messages
|
|
14
14
|
- π [GitHub](./docs/pipes/github.md), [GitLab](./docs/pipes/gitlab.md) & [Bitbucket](./docs/pipes/bitbucket.md) integration
|
|
15
15
|
- π
Realtime reports
|
|
16
|
-
- ποΈ Other test frameworks supported via [
|
|
16
|
+
- ποΈ Other test frameworks supported via [JUnit XML](./docs/junit.md) with [XML import configuration](./docs/xml-imports.md)
|
|
17
17
|
- πΆββοΈ Steps _(work in progress)_
|
|
18
18
|
- π [Logger](./docs/logger.md) _(work in progress, supports Jest for now)_
|
|
19
19
|
- βοΈ Custom properties and metadata _(work in progress)_
|
package/lib/bin/cli.js
CHANGED
|
@@ -37,12 +37,17 @@ program
|
|
|
37
37
|
program
|
|
38
38
|
.command('start')
|
|
39
39
|
.description('Start a new run and return its ID')
|
|
40
|
-
.
|
|
40
|
+
.option('--kind <type>', 'Specify run type: automated, manual, or mixed')
|
|
41
|
+
.action(async (opts) => {
|
|
41
42
|
(0, utils_js_1.cleanLatestRunId)();
|
|
42
43
|
console.log('Starting a new Run on Testomat.io...');
|
|
43
44
|
const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config_js_1.config.TESTOMATIO;
|
|
44
45
|
const client = new client_js_1.default({ apiKey });
|
|
45
|
-
|
|
46
|
+
const createRunParams = {};
|
|
47
|
+
if (opts.kind) {
|
|
48
|
+
createRunParams.kind = opts.kind;
|
|
49
|
+
}
|
|
50
|
+
client.createRun(createRunParams).then(() => {
|
|
46
51
|
console.log(process.env.runId);
|
|
47
52
|
process.exit(0);
|
|
48
53
|
});
|
|
@@ -70,6 +75,7 @@ program
|
|
|
70
75
|
.description('Run tests with the specified command')
|
|
71
76
|
.argument('<command>', 'Test runner command')
|
|
72
77
|
.option('--filter <filter>', 'Additional execution filter')
|
|
78
|
+
.option('--kind <type>', 'Specify run type: automated, manual, or mixed')
|
|
73
79
|
.action(async (command, opts) => {
|
|
74
80
|
const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config_js_1.config.TESTOMATIO;
|
|
75
81
|
const title = process.env.TESTOMATIO_TITLE;
|
|
@@ -108,8 +114,12 @@ program
|
|
|
108
114
|
process.exit(code);
|
|
109
115
|
});
|
|
110
116
|
};
|
|
117
|
+
const createRunParams = {};
|
|
118
|
+
if (opts.kind) {
|
|
119
|
+
createRunParams.kind = opts.kind;
|
|
120
|
+
}
|
|
111
121
|
if (apiKey) {
|
|
112
|
-
await client.createRun().then(runTests);
|
|
122
|
+
await client.createRun(createRunParams).then(runTests);
|
|
113
123
|
}
|
|
114
124
|
else {
|
|
115
125
|
await runTests();
|
package/lib/bin/startTest.js
CHANGED
|
@@ -35,7 +35,7 @@ while (i < args.length) {
|
|
|
35
35
|
newArgs[0] = 'start';
|
|
36
36
|
}
|
|
37
37
|
else if (arg === '--finish') {
|
|
38
|
-
// Map --finish to finish command
|
|
38
|
+
// Map --finish to finish command
|
|
39
39
|
newArgs[0] = 'finish';
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
@@ -46,8 +46,8 @@ while (i < args.length) {
|
|
|
46
46
|
}
|
|
47
47
|
// Execute the main CLI with mapped arguments
|
|
48
48
|
const child = (0, node_child_process_1.spawn)(process.execPath, [cliPath, ...newArgs], {
|
|
49
|
-
stdio: 'inherit'
|
|
49
|
+
stdio: 'inherit',
|
|
50
50
|
});
|
|
51
|
-
child.on('exit',
|
|
51
|
+
child.on('exit', code => {
|
|
52
52
|
process.exit(code);
|
|
53
53
|
});
|
package/lib/client.d.ts
CHANGED
package/lib/client.js
CHANGED
|
@@ -131,7 +131,7 @@ class Client {
|
|
|
131
131
|
*
|
|
132
132
|
* @returns {Promise<any>} - resolves to Run id which should be used to update / add test
|
|
133
133
|
*/
|
|
134
|
-
async createRun(params) {
|
|
134
|
+
async createRun(params = {}) {
|
|
135
135
|
if (!this.pipes || !this.pipes.length)
|
|
136
136
|
this.pipes = await (0, index_js_1.pipesFactory)(params || this.paramsForPipesFactory || {}, this.pipeStore);
|
|
137
137
|
debug('Creating run...');
|
|
@@ -139,7 +139,7 @@ class Client {
|
|
|
139
139
|
if (!this.pipes?.filter(p => p.isEnabled).length)
|
|
140
140
|
return Promise.resolve();
|
|
141
141
|
this.queue = this.queue
|
|
142
|
-
.then(() => Promise.all(this.pipes.map(p => p.createRun())))
|
|
142
|
+
.then(() => Promise.all(this.pipes.map(p => p.createRun(params))))
|
|
143
143
|
.catch(err => console.log(constants_js_1.APP_PREFIX, err))
|
|
144
144
|
.then(() => {
|
|
145
145
|
const runId = this.pipeStore?.runId;
|
|
@@ -173,7 +173,7 @@ class Client {
|
|
|
173
173
|
* @type {TestData}
|
|
174
174
|
*/
|
|
175
175
|
const { rid, error = null, steps: originalSteps, title, suite_title, } = testData;
|
|
176
|
-
|
|
176
|
+
let steps = originalSteps;
|
|
177
177
|
const uploadedFiles = [];
|
|
178
178
|
const stackArtifactsEnabled = (0, utils_js_1.transformEnvVarToBoolean)(process.env.TESTOMATIO_STACK_ARTIFACTS);
|
|
179
179
|
const { time = 0, example = null, files = [], filesBuffers = [], code = null, file, suite_id, test_id, timestamp, links, manuallyAttachedArtifacts, overwrite, tags, } = testData;
|
|
@@ -192,10 +192,10 @@ class Client {
|
|
|
192
192
|
message = error?.message;
|
|
193
193
|
}
|
|
194
194
|
let fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
195
|
-
if (stackArtifactsEnabled) {
|
|
196
|
-
|
|
197
|
-
uploadedFiles.push(this.uploader.uploadFileAsBuffer(Buffer.from(stripColors(fullLogs), 'utf8'), [this.runId, rid, `logs_${timestamp}.log`]));
|
|
195
|
+
if (stackArtifactsEnabled && fullLogs?.trim()?.length > 0) {
|
|
196
|
+
uploadedFiles.push(this.uploader.uploadFileAsBuffer(Buffer.from(stripColors(fullLogs), 'utf8'), [this.runId, rid, `logs_${+new Date}.log`]));
|
|
198
197
|
fullLogs = '';
|
|
198
|
+
steps = null;
|
|
199
199
|
}
|
|
200
200
|
if (!this.pipes || !this.pipes.length)
|
|
201
201
|
this.pipes = await (0, index_js_1.pipesFactory)(this.paramsForPipesFactory || {}, this.pipeStore);
|
|
@@ -294,7 +294,7 @@ class Client {
|
|
|
294
294
|
const uploadedArtifacts = this.uploader.successfulUploads.map(file => ({
|
|
295
295
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
296
296
|
link: file.link,
|
|
297
|
-
sizePretty: (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
297
|
+
sizePretty: file.size == null ? 'unknown' : (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
298
298
|
}));
|
|
299
299
|
uploadedArtifacts.forEach(upload => {
|
|
300
300
|
debug(`π’Uploaded artifact`, `${upload.relativePath},`, 'size:', `${upload.sizePretty},`, 'link:', `${upload.link}`);
|
|
@@ -304,7 +304,7 @@ class Client {
|
|
|
304
304
|
console.log(constants_js_1.APP_PREFIX, `ποΈ ${this.uploader.failedUploads.length} artifacts π΄${picocolors_1.default.bold('failed')} to upload`);
|
|
305
305
|
const failedUploads = this.uploader.failedUploads.map(file => ({
|
|
306
306
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
307
|
-
sizePretty: (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
307
|
+
sizePretty: file.size == null ? 'unknown' : (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
308
308
|
}));
|
|
309
309
|
const pathPadding = Math.max(...failedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
310
310
|
failedUploads.forEach(upload => {
|
package/lib/pipe/testomatio.d.ts
CHANGED
|
@@ -47,11 +47,12 @@ declare class TestomatioPipe implements Pipe {
|
|
|
47
47
|
prepareRun(opts: any): Promise<string[]>;
|
|
48
48
|
/**
|
|
49
49
|
* Creates a new run on Testomat.io
|
|
50
|
-
* @param {{isBatchEnabled?: boolean}} params
|
|
50
|
+
* @param {{isBatchEnabled?: boolean, kind?: string}} params
|
|
51
51
|
* @returns Promise<void>
|
|
52
52
|
*/
|
|
53
53
|
createRun(params?: {
|
|
54
54
|
isBatchEnabled?: boolean;
|
|
55
|
+
kind?: string;
|
|
55
56
|
}): Promise<void>;
|
|
56
57
|
runUrl: string;
|
|
57
58
|
runPublicUrl: any;
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -148,7 +148,7 @@ class TestomatioPipe {
|
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Creates a new run on Testomat.io
|
|
151
|
-
* @param {{isBatchEnabled?: boolean}} params
|
|
151
|
+
* @param {{isBatchEnabled?: boolean, kind?: string}} params
|
|
152
152
|
* @returns Promise<void>
|
|
153
153
|
*/
|
|
154
154
|
async createRun(params = {}) {
|
|
@@ -184,6 +184,7 @@ class TestomatioPipe {
|
|
|
184
184
|
label: this.label,
|
|
185
185
|
shared_run: this.sharedRun,
|
|
186
186
|
shared_run_timeout: this.sharedRunTimeout,
|
|
187
|
+
kind: params.kind,
|
|
187
188
|
}).filter(([, value]) => !!value));
|
|
188
189
|
debug(' >>>>>> Run params', JSON.stringify(runParams, null, 2));
|
|
189
190
|
if (this.runId) {
|
|
@@ -420,7 +421,7 @@ class TestomatioPipe {
|
|
|
420
421
|
if (this.runUrl && this.proceed) {
|
|
421
422
|
const notFinishedMessage = picocolors_1.default.yellow(picocolors_1.default.bold('Run was not finished because of $TESTOMATIO_PROCEED'));
|
|
422
423
|
console.log(constants_js_1.APP_PREFIX, `π ${notFinishedMessage}. Report URL: ${picocolors_1.default.magenta(this.runUrl)}`);
|
|
423
|
-
console.log(constants_js_1.APP_PREFIX, `π¬ Run to finish it: TESTOMATIO_RUN=${this.runId} npx
|
|
424
|
+
console.log(constants_js_1.APP_PREFIX, `π¬ Run to finish it: TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter finish`);
|
|
424
425
|
}
|
|
425
426
|
if (this.hasUnmatchedTests) {
|
|
426
427
|
console.log('');
|