@testomatio/reporter 2.3.5 → 2.3.6-beta.1-truncate-steps
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/adapter/codecept.js +3 -2
- package/lib/client.js +1 -1
- package/lib/pipe/testomatio.js +0 -1
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +9 -0
- package/package.json +1 -1
- package/src/adapter/codecept.js +5 -3
- package/src/client.js +2 -2
- package/src/pipe/testomatio.js +0 -2
- package/src/utils/utils.js +8 -0
package/lib/adapter/codecept.js
CHANGED
|
@@ -379,7 +379,7 @@ function formatCodeceptStep(step) {
|
|
|
379
379
|
if (!step)
|
|
380
380
|
return null;
|
|
381
381
|
const category = step.constructor.name === 'HelperStep' ? 'framework' : 'user';
|
|
382
|
-
const title =
|
|
382
|
+
const title = (0, utils_js_1.truncate)(step); // Use built-in toString
|
|
383
383
|
const duration = step.duration || 0; // Use built-in duration
|
|
384
384
|
const formattedStep = {
|
|
385
385
|
category,
|
|
@@ -403,10 +403,11 @@ function formatHookStep(step) {
|
|
|
403
403
|
if (step.actor && step.name) {
|
|
404
404
|
title = `${step.actor} ${step.name}`;
|
|
405
405
|
if (step.args && step.args.length > 0) {
|
|
406
|
-
const argsStr = step.args.map(arg => JSON.stringify(arg)).join(', ');
|
|
406
|
+
const argsStr = step.args.map(arg => (0, utils_js_1.truncate)(JSON.stringify(arg))).join(', ');
|
|
407
407
|
title += ` ${argsStr}`;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
+
title = (0, utils_js_1.truncate)(title);
|
|
410
411
|
return {
|
|
411
412
|
category: 'hook',
|
|
412
413
|
title,
|
package/lib/client.js
CHANGED
|
@@ -329,7 +329,7 @@ class Client {
|
|
|
329
329
|
*/
|
|
330
330
|
formatLogs({ error, steps, logs }) {
|
|
331
331
|
error = error?.trim();
|
|
332
|
-
logs = logs?.trim();
|
|
332
|
+
logs = logs?.trim().split('\n').map(l => (0, utils_js_1.truncate)(l)).join('\n');
|
|
333
333
|
if (Array.isArray(steps)) {
|
|
334
334
|
steps = steps
|
|
335
335
|
.map(step => (0, utils_js_1.formatStep)(step))
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -410,7 +410,6 @@ class TestomatioPipe {
|
|
|
410
410
|
tests: params.tests,
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
|
-
console.log(constants_js_1.APP_PREFIX, '✅ Testrun finished');
|
|
414
413
|
if (this.runUrl) {
|
|
415
414
|
console.log(constants_js_1.APP_PREFIX, '📊 Report Saved. Report URL:', picocolors_1.default.magenta(this.runUrl));
|
|
416
415
|
}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export function getPackageVersion(): any;
|
|
|
2
2
|
export const TEST_ID_REGEX: RegExp;
|
|
3
3
|
export const SUITE_ID_REGEX: RegExp;
|
|
4
4
|
export function ansiRegExp(): RegExp;
|
|
5
|
+
export function truncate(s: any, size?: number): any;
|
|
5
6
|
export function cleanLatestRunId(): any;
|
|
6
7
|
export function isSameTest(test: any, t: any): boolean;
|
|
7
8
|
export function fetchSourceCode(contents: any, opts?: {}): string;
|
package/lib/utils/utils.js
CHANGED
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.validateSuiteId = exports.testRunnerHelper = exports.specificTestInfo = exports.parseSuite = exports.isValidUrl = exports.humanize = exports.getTestomatIdFromTestTitle = exports.getCurrentDateTime = exports.foundedTestLog = exports.fileSystem = exports.fetchFilesFromStackTrace = exports.fetchIdFromOutput = exports.fetchIdFromCode = exports.fetchSourceCodeFromStackTrace = exports.fetchSourceCode = exports.isSameTest = exports.ansiRegExp = exports.SUITE_ID_REGEX = exports.TEST_ID_REGEX = void 0;
|
|
40
40
|
exports.getPackageVersion = getPackageVersion;
|
|
41
|
+
exports.truncate = truncate;
|
|
41
42
|
exports.cleanLatestRunId = cleanLatestRunId;
|
|
42
43
|
exports.formatStep = formatStep;
|
|
43
44
|
exports.readLatestRunId = readLatestRunId;
|
|
@@ -469,9 +470,17 @@ function transformEnvVarToBoolean(value) {
|
|
|
469
470
|
// if not recognized, return truthy if any value is set
|
|
470
471
|
return Boolean(value);
|
|
471
472
|
}
|
|
473
|
+
function truncate(s, size = 255) {
|
|
474
|
+
if (s.toString().trim().length < size) {
|
|
475
|
+
return s.toString();
|
|
476
|
+
}
|
|
477
|
+
return `${s.toString().substring(0, size)}...`;
|
|
478
|
+
}
|
|
472
479
|
|
|
473
480
|
module.exports.getPackageVersion = getPackageVersion;
|
|
474
481
|
|
|
482
|
+
module.exports.truncate = truncate;
|
|
483
|
+
|
|
475
484
|
module.exports.cleanLatestRunId = cleanLatestRunId;
|
|
476
485
|
|
|
477
486
|
module.exports.formatStep = formatStep;
|
package/package.json
CHANGED
package/src/adapter/codecept.js
CHANGED
|
@@ -2,7 +2,7 @@ import createDebugMessages from 'debug';
|
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import TestomatClient from '../client.js';
|
|
4
4
|
import { STATUS, APP_PREFIX, TESTOMAT_TMP_STORAGE_DIR } from '../constants.js';
|
|
5
|
-
import { getTestomatIdFromTestTitle, fileSystem } from '../utils/utils.js';
|
|
5
|
+
import { getTestomatIdFromTestTitle, truncate, fileSystem } from '../utils/utils.js';
|
|
6
6
|
import { services } from '../services/index.js';
|
|
7
7
|
import { dataStorage } from '../data-storage.js';
|
|
8
8
|
import codeceptjs from 'codeceptjs';
|
|
@@ -441,7 +441,7 @@ function formatCodeceptStep(step) {
|
|
|
441
441
|
if (!step) return null;
|
|
442
442
|
|
|
443
443
|
const category = step.constructor.name === 'HelperStep' ? 'framework' : 'user';
|
|
444
|
-
const title = step
|
|
444
|
+
const title = truncate(step); // Use built-in toString
|
|
445
445
|
const duration = step.duration || 0; // Use built-in duration
|
|
446
446
|
|
|
447
447
|
const formattedStep = {
|
|
@@ -469,10 +469,11 @@ function formatHookStep(step) {
|
|
|
469
469
|
if (step.actor && step.name) {
|
|
470
470
|
title = `${step.actor} ${step.name}`;
|
|
471
471
|
if (step.args && step.args.length > 0) {
|
|
472
|
-
const argsStr = step.args.map(arg => JSON.stringify(arg)).join(', ');
|
|
472
|
+
const argsStr = step.args.map(arg => truncate(JSON.stringify(arg))).join(', ');
|
|
473
473
|
title += ` ${argsStr}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
+
title = truncate(title);
|
|
476
477
|
|
|
477
478
|
return {
|
|
478
479
|
category: 'hook',
|
|
@@ -481,5 +482,6 @@ function formatHookStep(step) {
|
|
|
481
482
|
};
|
|
482
483
|
}
|
|
483
484
|
|
|
485
|
+
|
|
484
486
|
export { CodeceptReporter };
|
|
485
487
|
export default CodeceptReporter;
|
package/src/client.js
CHANGED
|
@@ -10,7 +10,7 @@ import { glob } from 'glob';
|
|
|
10
10
|
import path, { sep } from 'path';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { S3Uploader } from './uploader.js';
|
|
13
|
-
import { formatStep, readLatestRunId, storeRunId, validateSuiteId } from './utils/utils.js';
|
|
13
|
+
import { formatStep, truncate, readLatestRunId, storeRunId, validateSuiteId } from './utils/utils.js';
|
|
14
14
|
import { filesize as prettyBytes } from 'filesize';
|
|
15
15
|
|
|
16
16
|
const debug = createDebugMessages('@testomatio/reporter:client');
|
|
@@ -387,7 +387,7 @@ class Client {
|
|
|
387
387
|
*/
|
|
388
388
|
formatLogs({ error, steps, logs }) {
|
|
389
389
|
error = error?.trim();
|
|
390
|
-
logs = logs?.trim();
|
|
390
|
+
logs = logs?.trim().split('\n').map(l => truncate(l)).join('\n');
|
|
391
391
|
|
|
392
392
|
if (Array.isArray(steps)) {
|
|
393
393
|
steps = steps
|
package/src/pipe/testomatio.js
CHANGED
package/src/utils/utils.js
CHANGED
|
@@ -428,8 +428,16 @@ function transformEnvVarToBoolean(value) {
|
|
|
428
428
|
return Boolean(value);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
function truncate(s, size = 255) {
|
|
432
|
+
if (s.toString().trim().length < size) {
|
|
433
|
+
return s.toString();
|
|
434
|
+
}
|
|
435
|
+
return `${s.toString().substring(0, size)}...`;
|
|
436
|
+
}
|
|
437
|
+
|
|
431
438
|
export {
|
|
432
439
|
ansiRegExp,
|
|
440
|
+
truncate,
|
|
433
441
|
cleanLatestRunId,
|
|
434
442
|
isSameTest,
|
|
435
443
|
fetchSourceCode,
|