@testomatio/reporter 1.1.0 → 1.1.1-beta.1.fix-logger

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.
@@ -19,7 +19,7 @@ function saveArtifact(data, context = null) {
19
19
  * @param {...any} args
20
20
  */
21
21
  function logMessage(...args) {
22
- services.logger.templateLiteralLog(...args);
22
+ services.logger._templateLiteralLog(...args);
23
23
  }
24
24
 
25
25
  /**
package/lib/reporter.js CHANGED
@@ -1,19 +1,19 @@
1
1
  const TestomatClient = require('./client');
2
2
  const TRConstants = require('./constants');
3
+ const { services } = require('./services');
3
4
 
4
5
  const reporterFunctions = require('./reporter-functions');
5
6
 
6
7
  module.exports = {
7
8
  // TODO: deprecate in future; use log or testomat.log
8
- logger: reporterFunctions.log,
9
- testomatioLogger: reporterFunctions.log,
9
+ testomatioLogger: services.logger,
10
10
 
11
11
  artifact: reporterFunctions.artifact,
12
12
  log: reporterFunctions.log,
13
+ logger: services.logger,
13
14
  meta: reporterFunctions.keyValue,
14
15
  step: reporterFunctions.step,
15
16
 
16
17
  TestomatClient,
17
18
  TRConstants,
18
19
  };
19
-
@@ -44,8 +44,7 @@ class Logger {
44
44
  logLevel = process?.env?.LOG_LEVEL?.toUpperCase() || 'ALL';
45
45
 
46
46
  constructor() {
47
- // intercept console by default
48
- this.intercept(console);
47
+ if (!dataStorage.isFileStorage || process.env.TESTOMATIO_INTERCEPT_CONSOLE_LOGS) this.intercept(console);
49
48
  }
50
49
 
51
50
  /**
@@ -106,7 +105,7 @@ class Logger {
106
105
  * 2. Standard: log(`text ${someVar}`)
107
106
  * 3. Standard with multiple arguments: log('text', someVar)
108
107
  */
109
- templateLiteralLog(strings, ...args) {
108
+ _templateLiteralLog(strings, ...args) {
110
109
  if (Array.isArray(strings)) strings = strings.filter(item => item !== '').map(item => item.trim());
111
110
  if (Array.isArray(args)) args = args.filter(item => item !== '');
112
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-beta.1.fix-logger",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "test:adapter:jasmine:example": "./tests/adapter/examples/jasmine/passReporterOpts.sh && jasmine './tests/adapter/examples/jasmine/index.test.js' --reporter=./../../../lib/adapter/jasmine.js",
53
53
  "test:adapter:codecept:example": "codeceptjs run --config='./tests/adapter/examples/codecept/codecept.conf.js'",
54
54
  "test:adapter:cucumber:example": "cd ./tests/adapter/examples/cucumber && npx cucumber-js",
55
- "test:storage": "npx mocha tests-storage/artifact-storage.test.js && npx mocha tests-storage/data-storage.test.js && npx mocha tests-storage/logger.test.js && npx mocha tests-storage/reporter-functions.test.js"
55
+ "test:storage": "npx mocha tests-storage/artifact-storage.test.js && npx mocha tests-storage/data-storage.test.js && TESTOMATIO_INTERCEPT_CONSOLE_LOGS=true npx mocha tests-storage/logger.test.js && npx mocha tests-storage/reporter-functions.test.js"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@cucumber/cucumber": "^9.3.0",