@testomatio/reporter 2.3.7-beta.8-stack-artifacts → 2.3.7
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/bin/cli.js +0 -0
- package/lib/bin/reportXml.js +0 -0
- package/lib/bin/startTest.js +3 -3
- package/lib/bin/uploadArtifacts.js +0 -0
- package/lib/client.js +6 -6
- package/lib/pipe/testomatio.js +1 -1
- package/lib/template/testomatio.hbs +1366 -1026
- package/lib/utils/utils.js +7 -3
- package/package.json +1 -1
- package/src/bin/startTest.js +5 -5
- package/src/client.js +8 -8
- package/src/pipe/testomatio.js +1 -1
- package/src/template/testomatio.hbs +1366 -1026
- package/src/utils/utils.js +7 -3
package/lib/utils/utils.js
CHANGED
|
@@ -471,10 +471,14 @@ function transformEnvVarToBoolean(value) {
|
|
|
471
471
|
return Boolean(value);
|
|
472
472
|
}
|
|
473
473
|
function truncate(s, size = 255) {
|
|
474
|
-
if (s
|
|
475
|
-
return
|
|
474
|
+
if (s === undefined || s === null) {
|
|
475
|
+
return '';
|
|
476
|
+
}
|
|
477
|
+
const str = s.toString();
|
|
478
|
+
if (str.trim().length < size) {
|
|
479
|
+
return str;
|
|
476
480
|
}
|
|
477
|
-
return `${
|
|
481
|
+
return `${str.substring(0, size)}...`;
|
|
478
482
|
}
|
|
479
483
|
|
|
480
484
|
module.exports.getPackageVersion = getPackageVersion;
|
package/package.json
CHANGED
package/src/bin/startTest.js
CHANGED
|
@@ -18,7 +18,7 @@ const newArgs = ['run'];
|
|
|
18
18
|
let i = 0;
|
|
19
19
|
while (i < args.length) {
|
|
20
20
|
const arg = args[i];
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
if (arg === '-c' || arg === '--command') {
|
|
23
23
|
// Map -c/--command to positional argument for run command
|
|
24
24
|
i++;
|
|
@@ -33,7 +33,7 @@ while (i < args.length) {
|
|
|
33
33
|
// Map --launch to start command
|
|
34
34
|
newArgs[0] = 'start';
|
|
35
35
|
} else if (arg === '--finish') {
|
|
36
|
-
// Map --finish to finish command
|
|
36
|
+
// Map --finish to finish command
|
|
37
37
|
newArgs[0] = 'finish';
|
|
38
38
|
} else {
|
|
39
39
|
// Pass through other arguments
|
|
@@ -45,9 +45,9 @@ while (i < args.length) {
|
|
|
45
45
|
// Execute the main CLI with mapped arguments
|
|
46
46
|
|
|
47
47
|
const child = spawn(process.execPath, [cliPath, ...newArgs], {
|
|
48
|
-
stdio: 'inherit'
|
|
48
|
+
stdio: 'inherit',
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
child.on('exit',
|
|
51
|
+
child.on('exit', code => {
|
|
52
52
|
process.exit(code);
|
|
53
|
-
});
|
|
53
|
+
});
|
package/src/client.js
CHANGED
|
@@ -170,12 +170,12 @@ class Client {
|
|
|
170
170
|
title,
|
|
171
171
|
suite_title,
|
|
172
172
|
} = testData;
|
|
173
|
-
|
|
173
|
+
let steps = originalSteps;
|
|
174
174
|
|
|
175
175
|
const uploadedFiles = [];
|
|
176
176
|
const stackArtifactsEnabled = transformEnvVarToBoolean(process.env.TESTOMATIO_STACK_ARTIFACTS);
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
const {
|
|
180
180
|
time = 0,
|
|
181
181
|
example = null,
|
|
@@ -210,18 +210,18 @@ class Client {
|
|
|
210
210
|
|
|
211
211
|
let fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
212
212
|
|
|
213
|
-
if (stackArtifactsEnabled) {
|
|
214
|
-
const timestamp = +new Date;
|
|
213
|
+
if (stackArtifactsEnabled && fullLogs?.trim()?.length > 0) {
|
|
215
214
|
uploadedFiles.push(
|
|
216
215
|
this.uploader.uploadFileAsBuffer(
|
|
217
216
|
Buffer.from(stripColors(fullLogs), 'utf8'),
|
|
218
|
-
[this.runId, rid, `logs_${
|
|
217
|
+
[this.runId, rid, `logs_${+new Date}.log`]
|
|
219
218
|
)
|
|
220
219
|
);
|
|
221
220
|
fullLogs = '';
|
|
221
|
+
steps = null;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
if (!this.pipes || !this.pipes.length)
|
|
226
226
|
this.pipes = await pipesFactory(this.paramsForPipesFactory || {}, this.pipeStore);
|
|
227
227
|
|
|
@@ -336,7 +336,7 @@ class Client {
|
|
|
336
336
|
const uploadedArtifacts = this.uploader.successfulUploads.map(file => ({
|
|
337
337
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
338
338
|
link: file.link,
|
|
339
|
-
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
339
|
+
sizePretty: file.size == null ? 'unknown' : prettyBytes(file.size, { round: 0 }).toString(),
|
|
340
340
|
}));
|
|
341
341
|
|
|
342
342
|
uploadedArtifacts.forEach(upload => {
|
|
@@ -358,7 +358,7 @@ class Client {
|
|
|
358
358
|
);
|
|
359
359
|
const failedUploads = this.uploader.failedUploads.map(file => ({
|
|
360
360
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
361
|
-
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
361
|
+
sizePretty: file.size == null ? 'unknown' : prettyBytes(file.size, { round: 0 }).toString(),
|
|
362
362
|
}));
|
|
363
363
|
|
|
364
364
|
const pathPadding = Math.max(...failedUploads.map(upload => upload.relativePath.length)) + 1;
|
package/src/pipe/testomatio.js
CHANGED
|
@@ -472,7 +472,7 @@ class TestomatioPipe {
|
|
|
472
472
|
if (this.runUrl && this.proceed) {
|
|
473
473
|
const notFinishedMessage = pc.yellow(pc.bold('Run was not finished because of $TESTOMATIO_PROCEED'));
|
|
474
474
|
console.log(APP_PREFIX, `📊 ${notFinishedMessage}. Report URL: ${pc.magenta(this.runUrl)}`);
|
|
475
|
-
console.log(APP_PREFIX, `🛬 Run to finish it: TESTOMATIO_RUN=${this.runId} npx
|
|
475
|
+
console.log(APP_PREFIX, `🛬 Run to finish it: TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter finish`);
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
if (this.hasUnmatchedTests) {
|