@testomatio/reporter 1.6.0-beta-2-artifacts → 2.0.0-beta-esm

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.
Files changed (97) hide show
  1. package/lib/adapter/codecept.js +288 -330
  2. package/lib/adapter/cucumber/current.js +195 -203
  3. package/lib/adapter/cucumber/legacy.js +130 -155
  4. package/lib/adapter/cucumber.js +5 -16
  5. package/lib/adapter/cypress-plugin/index.js +91 -105
  6. package/lib/adapter/jasmine/jasmine.js +63 -0
  7. package/lib/adapter/jasmine.js +54 -53
  8. package/lib/adapter/jest.js +97 -99
  9. package/lib/adapter/mocha/mocha.js +125 -0
  10. package/lib/adapter/mocha.js +111 -140
  11. package/lib/adapter/playwright.js +168 -200
  12. package/lib/adapter/vitest.js +144 -143
  13. package/lib/adapter/webdriver.js +113 -97
  14. package/lib/bin/reportXml.js +49 -49
  15. package/lib/bin/startTest.js +80 -97
  16. package/lib/client.js +344 -385
  17. package/lib/config.js +16 -21
  18. package/lib/constants.js +49 -43
  19. package/lib/data-storage.js +206 -188
  20. package/lib/fileUploader.js +245 -0
  21. package/lib/junit-adapter/adapter.js +17 -20
  22. package/lib/junit-adapter/csharp.js +18 -14
  23. package/lib/junit-adapter/index.js +27 -25
  24. package/lib/junit-adapter/java.js +41 -53
  25. package/lib/junit-adapter/javascript.js +30 -27
  26. package/lib/junit-adapter/python.js +38 -37
  27. package/lib/junit-adapter/ruby.js +11 -8
  28. package/lib/output.js +44 -52
  29. package/lib/package.json +1 -0
  30. package/lib/pipe/bitbucket.js +208 -227
  31. package/lib/pipe/csv.js +111 -124
  32. package/lib/pipe/github.js +184 -211
  33. package/lib/pipe/gitlab.js +164 -205
  34. package/lib/pipe/html.js +253 -312
  35. package/lib/pipe/index.js +83 -63
  36. package/lib/pipe/testomatio.js +391 -454
  37. package/lib/reporter-functions.js +16 -20
  38. package/lib/reporter.js +47 -17
  39. package/lib/services/artifacts.js +55 -51
  40. package/lib/services/index.js +14 -12
  41. package/lib/services/key-values.js +56 -53
  42. package/lib/services/logger.js +227 -245
  43. package/lib/utils/chalk.js +10 -0
  44. package/lib/utils/pipe_utils.js +91 -84
  45. package/lib/utils/utils.js +289 -273
  46. package/lib/xmlReader.js +480 -519
  47. package/package.json +57 -19
  48. package/src/adapter/codecept.js +369 -0
  49. package/src/adapter/cucumber/current.js +228 -0
  50. package/src/adapter/cucumber/legacy.js +158 -0
  51. package/src/adapter/cucumber.js +4 -0
  52. package/src/adapter/cypress-plugin/index.js +110 -0
  53. package/src/adapter/jasmine.js +60 -0
  54. package/src/adapter/jest.js +107 -0
  55. package/src/adapter/mocha.cjs +2 -0
  56. package/src/adapter/mocha.js +156 -0
  57. package/src/adapter/playwright.js +222 -0
  58. package/src/adapter/vitest.js +183 -0
  59. package/src/adapter/webdriver.js +111 -0
  60. package/src/bin/reportXml.js +67 -0
  61. package/src/bin/startTest.js +119 -0
  62. package/src/client.js +423 -0
  63. package/src/config.js +30 -0
  64. package/src/constants.js +49 -0
  65. package/src/data-storage.js +204 -0
  66. package/src/fileUploader.js +307 -0
  67. package/src/junit-adapter/adapter.js +23 -0
  68. package/src/junit-adapter/csharp.js +16 -0
  69. package/src/junit-adapter/index.js +28 -0
  70. package/src/junit-adapter/java.js +58 -0
  71. package/src/junit-adapter/javascript.js +31 -0
  72. package/src/junit-adapter/python.js +42 -0
  73. package/src/junit-adapter/ruby.js +10 -0
  74. package/src/output.js +57 -0
  75. package/src/pipe/bitbucket.js +254 -0
  76. package/src/pipe/csv.js +140 -0
  77. package/src/pipe/github.js +234 -0
  78. package/src/pipe/gitlab.js +229 -0
  79. package/src/pipe/html.js +366 -0
  80. package/src/pipe/index.js +73 -0
  81. package/src/pipe/testomatio.js +498 -0
  82. package/src/reporter-functions.js +44 -0
  83. package/src/reporter.cjs +22 -0
  84. package/src/reporter.js +24 -0
  85. package/src/services/artifacts.js +59 -0
  86. package/src/services/index.js +13 -0
  87. package/src/services/key-values.js +59 -0
  88. package/src/services/logger.js +314 -0
  89. package/src/template/emptyData.svg +23 -0
  90. package/src/template/testomatio.hbs +1421 -0
  91. package/src/utils/chalk.js +13 -0
  92. package/src/utils/pipe_utils.js +127 -0
  93. package/src/utils/utils.js +341 -0
  94. package/src/xmlReader.js +551 -0
  95. package/lib/bin/cli.js +0 -216
  96. package/lib/bin/uploadArtifacts.js +0 -86
  97. package/lib/uploader.js +0 -312
@@ -1,272 +1,255 @@
1
- const chalk = require('chalk');
2
- const debug = require('debug')('@testomatio/reporter:services-logger');
3
- const { dataStorage } = require('../data-storage');
4
-
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = void 0;
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
+ const debug_1 = __importDefault(require("debug"));
9
+ const data_storage_js_1 = require("../data-storage.js");
10
+ const debug = (0, debug_1.default)('@testomatio/reporter:services-logger');
5
11
  const LOG_METHODS = ['assert', 'debug', 'error', 'info', 'log', 'trace', 'warn'];
6
12
  const LEVELS = {
7
- ALL: { severity: 1, color: '' },
8
- VERBOSE: { severity: 3, color: 'grey' },
9
- TRACE: { severity: 5, color: 'grey' },
10
- DEBUG: { severity: 7, color: 'cyan' },
11
- INFO: { severity: 9, color: 'black' },
12
- LOG: { severity: 11, color: 'black' },
13
- WARN: { severity: 13, color: 'yellow' },
14
- ERROR: { severity: 15, color: 'red' },
13
+ ALL: { severity: 1, color: '' },
14
+ VERBOSE: { severity: 3, color: 'grey' },
15
+ TRACE: { severity: 5, color: 'grey' },
16
+ DEBUG: { severity: 7, color: 'cyan' },
17
+ INFO: { severity: 9, color: 'black' },
18
+ LOG: { severity: 11, color: 'black' },
19
+ WARN: { severity: 13, color: 'yellow' },
20
+ ERROR: { severity: 15, color: 'red' },
15
21
  };
16
-
17
22
  // ! DON'T use console.log, console.warn, etc in this file, because it will lead to infinite loop
18
23
  // use debug() instead
19
-
20
24
  /**
21
25
  * Logger allows to intercept logs from any logger (console.log, tracer, pino, etc)
22
26
  * and save in the testomatio reporter.
23
27
  * Supports different syntaxes to satisfy any user preferences.
24
28
  */
25
29
  class Logger {
26
- // set default logger to be used in log, warn, error, etc methods
27
- #originalUserLogger = { ...console };
28
-
29
- #userLoggerWithOverridenMethods;
30
-
31
- static #instance;
32
-
33
- /**
34
- *
35
- * @returns {Logger}
36
- */
37
- static getInstance() {
38
- if (!this.#instance) {
39
- this.#instance = new Logger();
30
+ // set default logger to be used in log, warn, error, etc methods
31
+ #originalUserLogger = { ...console };
32
+ #userLoggerWithOverridenMethods;
33
+ static #instance;
34
+ /**
35
+ *
36
+ * @returns {Logger}
37
+ */
38
+ static getInstance() {
39
+ if (!this.#instance) {
40
+ this.#instance = new Logger();
41
+ }
42
+ return this.#instance;
40
43
  }
41
- return this.#instance;
42
- }
43
-
44
- logLevel = process?.env?.LOG_LEVEL?.toUpperCase() || 'ALL';
45
-
46
- constructor() {
47
- if (!dataStorage.isFileStorage || process.env.TESTOMATIO_INTERCEPT_CONSOLE_LOGS) this.intercept(console);
48
- }
49
-
50
- /**
51
- * Allows you to define a step inside a test. Step name is attached to the report and
52
- * helps to understand the test flow.
53
- * @param {*} strings
54
- * @param {...any} values
55
- */
56
- step(strings, ...values) {
57
- let logs = '';
58
- for (let i = 0; i < strings.length; i++) {
59
- logs += strings[i];
60
- if (i < values.length) {
61
- logs += values[i];
62
- }
44
+ logLevel = process?.env?.LOG_LEVEL?.toUpperCase() || 'ALL';
45
+ constructor() {
46
+ if (!data_storage_js_1.dataStorage.isFileStorage ||
47
+ (process.env.TESTOMATIO_INTERCEPT_CONSOLE_LOGS && process.env.TESTOMATIO_INTERCEPT_CONSOLE_LOGS !== 'false'))
48
+ this.intercept(console);
63
49
  }
64
- logs = chalk.blue(`> ${logs}`);
65
- dataStorage.putData('log', logs);
66
- }
67
-
68
- /**
69
- *
70
- * @param {string} context testId or test context from test runner
71
- * @returns {string[]}
72
- */
73
- getLogs(context) {
74
- const logs = dataStorage.getData('log', context);
75
- if (!logs) return [];
76
- return logs;
77
- }
78
-
79
- #stringifyLogs(...args) {
80
- const logs = [];
81
- // stringify everything except strings
82
- for (const arg of args) {
83
- // ignore empty strings
84
- if (arg === '') continue;
85
- if (typeof arg === 'string') {
86
- logs.push(arg);
87
- } else if (Array.isArray(arg)) {
88
- logs.push(arg.join(' '));
89
- } else {
50
+ /**
51
+ * Allows you to define a step inside a test. Step name is attached to the report and
52
+ * helps to understand the test flow.
53
+ * @param {*} strings
54
+ * @param {...any} values
55
+ */
56
+ step(strings, ...values) {
57
+ let logs = '';
58
+ for (let i = 0; i < strings.length; i++) {
59
+ logs += strings[i];
60
+ if (i < values.length) {
61
+ logs += values[i];
62
+ }
63
+ }
64
+ logs = picocolors_1.default.blue(`> ${logs}`);
65
+ data_storage_js_1.dataStorage.putData('log', logs);
66
+ }
67
+ /**
68
+ *
69
+ * @param {string} context testId or test context from test runner
70
+ * @returns {string[]}
71
+ */
72
+ getLogs(context) {
73
+ const logs = data_storage_js_1.dataStorage.getData('log', context);
74
+ if (!logs)
75
+ return [];
76
+ return logs;
77
+ }
78
+ #stringifyLogs(...args) {
79
+ const logs = [];
80
+ // stringify everything except strings
81
+ for (const arg of args) {
82
+ // ignore empty strings
83
+ if (arg === '')
84
+ continue;
85
+ if (typeof arg === 'string') {
86
+ logs.push(arg);
87
+ }
88
+ else if (Array.isArray(arg)) {
89
+ logs.push(arg.join(' '));
90
+ }
91
+ else {
92
+ try {
93
+ // eslint-disable-next-line no-unused-expressions
94
+ this.prettyObjects ? logs.push(JSON.stringify(arg, null, 2)) : logs.push(JSON.stringify(arg));
95
+ }
96
+ catch (e) {
97
+ debug('Error while stringify object', e);
98
+ logs.push(arg);
99
+ }
100
+ }
101
+ }
102
+ return logs.join(' ');
103
+ }
104
+ /**
105
+ * Tagget template literal. Allows to use different syntaxes:
106
+ * 1. Tagget template: log`text ${someVar}`
107
+ * 2. Standard: log(`text ${someVar}`)
108
+ * 3. Standard with multiple arguments: log('text', someVar)
109
+ */
110
+ _templateLiteralLog(strings, ...args) {
111
+ if (Array.isArray(strings))
112
+ strings = strings.filter(item => item !== '').map(item => item.trim());
113
+ if (Array.isArray(args))
114
+ args = args.filter(item => item !== '');
115
+ let logs;
116
+ // this block means tagged template is used (syntax like $`text ${someVar}`)
117
+ if (Array.isArray(strings) && strings.length === args.length + 1) {
118
+ logs = strings.reduce((result, current, index) => result +
119
+ current +
120
+ // strings are splitted by args when use tagged template, thus we add arg after each string
121
+ // it looks like: `string1 arg1 string2 arg2 string3`
122
+ (args[index] !== undefined // eslint-disable-line no-nested-ternary
123
+ ? typeof args[index] === 'string'
124
+ ? args[index] // add arg as it is
125
+ : this.#stringifyLogs(args[index]) // stringify arg
126
+ : ''),
127
+ // initial accumulator value
128
+ '');
129
+ }
130
+ else {
131
+ // this block means arguments syntax is used (syntax like $('text', someVar))
132
+ // in this case strings represents just a first argument
133
+ logs = this.#stringifyLogs(strings, ...args);
134
+ }
135
+ this.#originalUserLogger.log(logs);
136
+ data_storage_js_1.dataStorage.putData('log', logs);
137
+ }
138
+ /**
139
+ * This function is a wrapper for each logging methods (log, warn, error etc) (not to repeat the same code)
140
+ * @param {*} argsArray
141
+ * @param {*} level
142
+ * @returns
143
+ */
144
+ #logWrapper(argsArray, level) {
145
+ if (!argsArray.length)
146
+ return;
147
+ const severity = LEVELS[level].severity;
148
+ if (severity < LEVELS[this.logLevel]?.severity)
149
+ return;
150
+ const logs = this.#stringifyLogs(...argsArray);
151
+ const colorizedLogs = picocolors_1.default[LEVELS[level].color](logs);
152
+ // do not attach logs from testomatio reporter itself
153
+ if (!logs.includes('[TESTOMATIO]')) {
154
+ data_storage_js_1.dataStorage.putData('log', colorizedLogs);
155
+ }
90
156
  try {
91
- // eslint-disable-next-line no-unused-expressions
92
- this.prettyObjects ? logs.push(JSON.stringify(arg, null, 2)) : logs.push(JSON.stringify(arg));
93
- } catch (e) {
94
- debug('Error while stringify object', e);
95
- logs.push(arg);
157
+ // level.toLowerCase() represents method name (log, warn, error, etc)
158
+ this.#originalUserLogger[level.toLowerCase()](colorizedLogs);
159
+ }
160
+ catch (e) {
161
+ // method could be unexisting, ignore error
96
162
  }
97
- }
98
163
  }
99
- return logs.join(' ');
100
- }
101
-
102
- /**
103
- * Tagget template literal. Allows to use different syntaxes:
104
- * 1. Tagget template: log`text ${someVar}`
105
- * 2. Standard: log(`text ${someVar}`)
106
- * 3. Standard with multiple arguments: log('text', someVar)
107
- */
108
- _templateLiteralLog(strings, ...args) {
109
- if (Array.isArray(strings)) strings = strings.filter(item => item !== '').map(item => item.trim());
110
- if (Array.isArray(args)) args = args.filter(item => item !== '');
111
-
112
- let logs;
113
- // this block means tagged template is used (syntax like $`text ${someVar}`)
114
- if (Array.isArray(strings) && strings.length === args.length + 1) {
115
- logs = strings.reduce(
116
- (result, current, index) =>
117
- result +
118
- current +
119
- // strings are splitted by args when use tagged template, thus we add arg after each string
120
- // it looks like: `string1 arg1 string2 arg2 string3`
121
- (args[index] !== undefined // eslint-disable-line no-nested-ternary
122
- ? typeof args[index] === 'string'
123
- ? args[index] // add arg as it is
124
- : this.#stringifyLogs(args[index]) // stringify arg
125
- : ''),
126
- // initial accumulator value
127
- '',
128
- );
129
- } else {
130
- // this block means arguments syntax is used (syntax like $('text', someVar))
131
- // in this case strings represents just a first argument
132
- logs = this.#stringifyLogs(strings, ...args);
164
+ assert(...args) {
165
+ this.#logWrapper(args, 'ERROR');
133
166
  }
134
- this.#originalUserLogger.log(logs);
135
- dataStorage.putData('log', logs);
136
- }
137
-
138
- /**
139
- * This function is a wrapper for each logging methods (log, warn, error etc) (not to repeat the same code)
140
- * @param {*} argsArray
141
- * @param {*} level
142
- * @returns
143
- */
144
- #logWrapper(argsArray, level) {
145
- if (!argsArray.length) return;
146
-
147
- const severity = LEVELS[level].severity;
148
- if (severity < LEVELS[this.logLevel]?.severity) return;
149
-
150
- const logs = this.#stringifyLogs(...argsArray);
151
-
152
- const colorizedLogs = chalk[LEVELS[level].color](logs);
153
- // do not attach logs from testomatio reporter itself
154
- if (!logs.includes('[TESTOMATIO]')) {
155
- dataStorage.putData('log', colorizedLogs);
167
+ debug(...args) {
168
+ this.#logWrapper(args, 'DEBUG');
156
169
  }
157
-
158
- try {
159
- // level.toLowerCase() represents method name (log, warn, error, etc)
160
- this.#originalUserLogger[level.toLowerCase()](colorizedLogs);
161
- } catch (e) {
162
- // method could be unexisting, ignore error
170
+ error(...args) {
171
+ this.#logWrapper(args, 'ERROR');
163
172
  }
164
- }
165
-
166
- assert(...args) {
167
- this.#logWrapper(args, 'ERROR');
168
- }
169
-
170
- debug(...args) {
171
- this.#logWrapper(args, 'DEBUG');
172
- }
173
-
174
- error(...args) {
175
- this.#logWrapper(args, 'ERROR');
176
- }
177
-
178
- info(...args) {
179
- this.#logWrapper(args, 'INFO');
180
- }
181
-
182
- log(...args) {
183
- this.#logWrapper(args, 'LOG');
184
- }
185
-
186
- trace(...args) {
187
- this.#logWrapper(args, 'TRACE');
188
- }
189
-
190
- warn(...args) {
191
- this.#logWrapper(args, 'WARN');
192
- }
193
-
194
- /**
195
- * Intercepts user logger messages.
196
- * When call this method, Logger start to control the user logger
197
- * @param {*} userLogger
198
- */
199
- intercept(userLogger) {
200
- // STEP 1: reset previously intercepted logger methods to original
201
- if (this.#userLoggerWithOverridenMethods) {
202
- for (const method of LOG_METHODS) {
203
- this.#userLoggerWithOverridenMethods[method] = this.#originalUserLogger[method];
204
- }
173
+ info(...args) {
174
+ this.#logWrapper(args, 'INFO');
205
175
  }
206
-
207
- // STEP 2: intercept new logger
208
- this.#originalUserLogger = { ...userLogger };
209
-
210
- const isUserLoggerConsole = userLogger.toString?.().toLowerCase() === '[object console]';
211
- debug(`Intercepting ${isUserLoggerConsole ? 'console' : 'some user'} logger}`);
212
-
213
- // override user logger (any, e.g. console) methods to intercept log messages
214
- for (const method of LOG_METHODS) {
215
- /*
216
- its better to create method even if it does not exist in user logger;
217
- on method invocation, we will store the data anyway and catch block will prevent potential errors
218
- while trying to output the message to terminal
219
- */
220
- // if (!this._loggerToIntercept[method]) continue;
221
- userLogger[method] = (...args) => this[method](...args);
176
+ log(...args) {
177
+ this.#logWrapper(args, 'LOG');
222
178
  }
223
-
224
- this.#userLoggerWithOverridenMethods = userLogger;
225
-
226
- /*
227
- Initial idea was to intercept any logger (tracer, pino, etc),
228
- intercept message and provide output by the same logger.
229
- But reality brings some problems: the same messages are intercepted multiple times
230
- (because of multiple loggers are created at the same terminal process).
231
- Also its difficult to understand (actually did not find the way to do it) if logger was already intercepted or not.
232
- Thus, decided to intercept only console by default and provide output by default console.
233
- It means, if user uses his own logger, its messages will be intercepted,
234
- but the output will be always provided by console.
235
- TODO: try to implement the providing output to terminal by user logger
236
- */
237
- }
238
-
239
- stopInterception() {
240
- debug('Stop ntercepting logs');
241
-
242
- // restore original user logger
243
- if (this.#userLoggerWithOverridenMethods) {
244
- for (const method of LOG_METHODS) {
245
- this.#userLoggerWithOverridenMethods[method] = this.#originalUserLogger[method];
246
- }
179
+ trace(...args) {
180
+ this.#logWrapper(args, 'TRACE');
181
+ }
182
+ warn(...args) {
183
+ this.#logWrapper(args, 'WARN');
184
+ }
185
+ /**
186
+ * Intercepts user logger messages.
187
+ * When call this method, Logger start to control the user logger
188
+ * @param {*} userLogger
189
+ */
190
+ intercept(userLogger) {
191
+ // STEP 1: reset previously intercepted logger methods to original
192
+ if (this.#userLoggerWithOverridenMethods) {
193
+ for (const method of LOG_METHODS) {
194
+ this.#userLoggerWithOverridenMethods[method] = this.#originalUserLogger[method];
195
+ }
196
+ }
197
+ // STEP 2: intercept new logger
198
+ this.#originalUserLogger = { ...userLogger };
199
+ const isUserLoggerConsole = userLogger.toString?.().toLowerCase() === '[object console]';
200
+ debug(`Intercepting ${isUserLoggerConsole ? 'console' : 'some user'} logger}`);
201
+ // override user logger (any, e.g. console) methods to intercept log messages
202
+ for (const method of LOG_METHODS) {
203
+ /*
204
+ its better to create method even if it does not exist in user logger;
205
+ on method invocation, we will store the data anyway and catch block will prevent potential errors
206
+ while trying to output the message to terminal
207
+ */
208
+ // if (!this._loggerToIntercept[method]) continue;
209
+ userLogger[method] = (...args) => this[method](...args);
210
+ }
211
+ this.#userLoggerWithOverridenMethods = userLogger;
212
+ /*
213
+ Initial idea was to intercept any logger (tracer, pino, etc),
214
+ intercept message and provide output by the same logger.
215
+ But reality brings some problems: the same messages are intercepted multiple times
216
+ (because of multiple loggers are created at the same terminal process).
217
+ Also its difficult to understand (actually did not find the way to do it) if logger was already intercepted or not.
218
+ Thus, decided to intercept only console by default and provide output by default console.
219
+ It means, if user uses his own logger, its messages will be intercepted,
220
+ but the output will be always provided by console.
221
+ TODO: try to implement the providing output to terminal by user logger
222
+ */
223
+ }
224
+ stopInterception() {
225
+ debug('Stop ntercepting logs');
226
+ // restore original user logger
227
+ if (this.#userLoggerWithOverridenMethods) {
228
+ for (const method of LOG_METHODS) {
229
+ this.#userLoggerWithOverridenMethods[method] = this.#originalUserLogger[method];
230
+ }
231
+ }
232
+ }
233
+ /**
234
+ * Allows to configure logger. Make sure you do it before the logger usage in your code.
235
+ *
236
+ * @param {Object} [config={}] - The configuration object.
237
+ * @param {string} [config.logLevel] - The desired log level. Valid values are 'DEBUG', 'INFO', 'WARN', and 'ERROR'.
238
+ * @param {boolean} [config.prettyObjects] - Specifies whether to enable pretty printing of objects.
239
+ * @returns {void}
240
+ */
241
+ configure(config = {}) {
242
+ if (!config)
243
+ return;
244
+ if (config.prettyObjects === false || config.prettyObjects === true)
245
+ this.prettyObjects = config.prettyObjects;
246
+ if (config.logLevel)
247
+ this.logLevel = config.logLevel.toUpperCase();
247
248
  }
248
- }
249
-
250
- /**
251
- * Allows to configure logger. Make sure you do it before the logger usage in your code.
252
- *
253
- * @param {Object} [config={}] - The configuration object.
254
- * @param {string} [config.logLevel] - The desired log level. Valid values are 'DEBUG', 'INFO', 'WARN', and 'ERROR'.
255
- * @param {boolean} [config.prettyObjects] - Specifies whether to enable pretty printing of objects.
256
- * @returns {void}
257
- */
258
- configure(config = {}) {
259
- if (!config) return;
260
- if (config.prettyObjects === false || config.prettyObjects === true) this.prettyObjects = config.prettyObjects;
261
- if (config.logLevel) this.logLevel = config.logLevel.toUpperCase();
262
- }
263
249
  }
264
-
265
- module.exports.logger = Logger.getInstance();
266
-
250
+ exports.logger = Logger.getInstance();
267
251
  // TODO: parse passed arguments as {level: 'str', message: 'str'} because some loggers use such syntax;
268
252
  // upd: did not face such loggers, but still could be useful
269
-
270
253
  /* Cypress
271
254
  There is no listener like "after:test" in cypress, only "after:spec" is available.
272
255
  Thus, cannot separate logs even when I gather them (because I don't know when the test is done, just know about suite).
@@ -306,6 +289,5 @@ Finally, in the test it will look like:
306
289
 
307
290
  Parallelization in Cypress is only available if using Cypress Dashboard??
308
291
  */
309
-
310
292
  // TODO: add time to logs
311
293
  // TODO: add logger name to logs?
@@ -0,0 +1,10 @@
1
+ // import chalk from 'chalk';
2
+ // let chalkToUse = chalk;
3
+ // try {
4
+ // if (typeof require !== 'undefined') {
5
+ // chalkToUse = require('chalk4');
6
+ // }
7
+ // } catch (e) {
8
+ // chalkToUse = chalk;
9
+ // }
10
+ // export default chalkToUse;