@testomatio/reporter 2.3.2 → 2.3.3

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 CHANGED
@@ -61,7 +61,6 @@ program
61
61
  const client = new client_js_1.default({ apiKey });
62
62
  // @ts-ignore
63
63
  client.updateRunStatus(constants_js_1.STATUS.FINISHED).then(() => {
64
- console.log(picocolors_1.default.yellow(`Run ${process.env.TESTOMATIO_RUN} was finished`));
65
64
  process.exit(0);
66
65
  });
67
66
  });
@@ -31,7 +31,7 @@ declare class TestomatioPipe implements Pipe {
31
31
  env: string;
32
32
  label: string;
33
33
  client: Gaxios;
34
- proceed: string;
34
+ proceed: boolean;
35
35
  jiraId: string;
36
36
  runId: any;
37
37
  createNewTests: any;
@@ -78,7 +78,7 @@ class TestomatioPipe {
78
78
  });
79
79
  this.isEnabled = true;
80
80
  // do not finish this run (for parallel testing)
81
- this.proceed = process.env.TESTOMATIO_PROCEED;
81
+ this.proceed = (0, utils_js_1.transformEnvVarToBoolean)(process.env.TESTOMATIO_PROCEED);
82
82
  this.jiraId = process.env.TESTOMATIO_JIRA_ID;
83
83
  this.runId = params.runId || process.env.TESTOMATIO_RUN;
84
84
  this.createNewTests = params.createNewTests ?? !!process.env.TESTOMATIO_CREATE;
@@ -396,6 +396,7 @@ class TestomatioPipe {
396
396
  tests: params.tests,
397
397
  }
398
398
  });
399
+ console.log(constants_js_1.APP_PREFIX, '✅ Testrun finished');
399
400
  if (this.runUrl) {
400
401
  console.log(constants_js_1.APP_PREFIX, '📊 Report Saved. Report URL:', picocolors_1.default.magenta(this.runUrl));
401
402
  }
@@ -51,6 +51,7 @@ export function storeRunId(runId: any): any;
51
51
  export namespace testRunnerHelper {
52
52
  function getNameOfCurrentlyRunningTest(): any;
53
53
  }
54
+ export function transformEnvVarToBoolean(value: any): boolean;
54
55
  /**
55
56
  * Validates TESTOMATIO_SUITE environment variable format
56
57
  * @param {String} suiteId - suite ID to validate
@@ -43,6 +43,7 @@ exports.formatStep = formatStep;
43
43
  exports.readLatestRunId = readLatestRunId;
44
44
  exports.removeColorCodes = removeColorCodes;
45
45
  exports.storeRunId = storeRunId;
46
+ exports.transformEnvVarToBoolean = transformEnvVarToBoolean;
46
47
  const url_1 = require("url");
47
48
  const path_1 = __importStar(require("path"));
48
49
  const picocolors_1 = __importDefault(require("picocolors"));
@@ -453,6 +454,21 @@ function getPackageVersion() {
453
454
  const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
454
455
  return packageJson.version;
455
456
  }
457
+ function transformEnvVarToBoolean(value) {
458
+ if (value === undefined || value === null || value === 'undefined')
459
+ return false;
460
+ if (typeof value === 'boolean')
461
+ return value;
462
+ if (typeof value !== 'string')
463
+ value = String(value);
464
+ value = value.trim();
465
+ if (['1', 'true', 'yes', 'on'].includes(value.toLowerCase()))
466
+ return true;
467
+ if (['0', 'false', 'no', 'off'].includes(value.toLowerCase()))
468
+ return false;
469
+ // if not recognized, return truthy if any value is set
470
+ return Boolean(value);
471
+ }
456
472
 
457
473
  module.exports.getPackageVersion = getPackageVersion;
458
474
 
@@ -466,6 +482,8 @@ module.exports.removeColorCodes = removeColorCodes;
466
482
 
467
483
  module.exports.storeRunId = storeRunId;
468
484
 
485
+ module.exports.transformEnvVarToBoolean = transformEnvVarToBoolean;
486
+
469
487
  module.exports.getTestomatIdFromTestTitle = getTestomatIdFromTestTitle;
470
488
 
471
489
  module.exports.parseSuite = parseSuite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
package/src/bin/cli.js CHANGED
@@ -65,7 +65,6 @@ program
65
65
 
66
66
  // @ts-ignore
67
67
  client.updateRunStatus(STATUS.FINISHED).then(() => {
68
- console.log(pc.yellow(`Run ${process.env.TESTOMATIO_RUN} was finished`));
69
68
  process.exit(0);
70
69
  });
71
70
  });
@@ -3,7 +3,7 @@ import pc from 'picocolors';
3
3
  import { Gaxios } from 'gaxios';
4
4
  import JsonCycle from 'json-cycle';
5
5
  import { APP_PREFIX, STATUS, AXIOS_TIMEOUT, REPORTER_REQUEST_RETRIES } from '../constants.js';
6
- import { isValidUrl, foundedTestLog, readLatestRunId } from '../utils/utils.js';
6
+ import { isValidUrl, foundedTestLog, readLatestRunId, transformEnvVarToBoolean } from '../utils/utils.js';
7
7
  import { parseFilterParams, generateFilterRequestParams, setS3Credentials } from '../utils/pipe_utils.js';
8
8
  import { config } from '../config.js';
9
9
 
@@ -79,7 +79,7 @@ class TestomatioPipe {
79
79
 
80
80
  this.isEnabled = true;
81
81
  // do not finish this run (for parallel testing)
82
- this.proceed = process.env.TESTOMATIO_PROCEED;
82
+ this.proceed = transformEnvVarToBoolean(process.env.TESTOMATIO_PROCEED);
83
83
  this.jiraId = process.env.TESTOMATIO_JIRA_ID;
84
84
  this.runId = params.runId || process.env.TESTOMATIO_RUN;
85
85
  this.createNewTests = params.createNewTests ?? !!process.env.TESTOMATIO_CREATE;
@@ -438,6 +438,9 @@ class TestomatioPipe {
438
438
  tests: params.tests,
439
439
  }
440
440
  });
441
+
442
+ console.log(APP_PREFIX, '✅ Testrun finished');
443
+
441
444
  if (this.runUrl) {
442
445
  console.log(APP_PREFIX, '📊 Report Saved. Report URL:', pc.magenta(this.runUrl));
443
446
  }
@@ -416,6 +416,18 @@ export function getPackageVersion() {
416
416
  return packageJson.version;
417
417
  }
418
418
 
419
+ function transformEnvVarToBoolean(value) {
420
+ if (value === undefined || value === null || value === 'undefined') return false;
421
+ if (typeof value === 'boolean') return value;
422
+ if (typeof value !== 'string') value = String(value);
423
+ value = value.trim();
424
+
425
+ if (['1', 'true', 'yes', 'on'].includes(value.toLowerCase())) return true;
426
+ if (['0', 'false', 'no', 'off'].includes(value.toLowerCase())) return false;
427
+ // if not recognized, return truthy if any value is set
428
+ return Boolean(value);
429
+ }
430
+
419
431
  export {
420
432
  ansiRegExp,
421
433
  cleanLatestRunId,
@@ -438,5 +450,6 @@ export {
438
450
  specificTestInfo,
439
451
  storeRunId,
440
452
  testRunnerHelper,
453
+ transformEnvVarToBoolean,
441
454
  validateSuiteId,
442
455
  };