@testomatio/reporter 2.0.1-beta.4 → 2.0.1-beta.5-timestamp

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 (148) hide show
  1. package/lib/adapter/codecept.js +335 -293
  2. package/lib/adapter/cucumber/current.js +203 -195
  3. package/lib/adapter/cucumber/legacy.js +155 -130
  4. package/lib/adapter/cucumber.js +16 -5
  5. package/lib/adapter/cypress-plugin/index.js +105 -91
  6. package/lib/adapter/jasmine.js +53 -54
  7. package/lib/adapter/jest.js +99 -97
  8. package/lib/adapter/mocha.js +141 -112
  9. package/lib/adapter/playwright.js +231 -199
  10. package/lib/adapter/vitest.js +149 -150
  11. package/lib/adapter/webdriver.js +121 -144
  12. package/lib/bin/cli.js +211 -229
  13. package/lib/bin/reportXml.js +52 -51
  14. package/lib/bin/startTest.js +95 -83
  15. package/lib/bin/uploadArtifacts.js +61 -56
  16. package/lib/client.js +465 -424
  17. package/lib/config.js +23 -18
  18. package/lib/constants.js +44 -50
  19. package/lib/data-storage.js +188 -216
  20. package/lib/junit-adapter/adapter.js +20 -17
  21. package/lib/junit-adapter/csharp.js +14 -28
  22. package/lib/junit-adapter/index.js +25 -27
  23. package/lib/junit-adapter/java.js +53 -41
  24. package/lib/junit-adapter/javascript.js +27 -30
  25. package/lib/junit-adapter/python.js +37 -38
  26. package/lib/junit-adapter/ruby.js +8 -11
  27. package/lib/output.js +52 -44
  28. package/lib/pipe/bitbucket.js +230 -223
  29. package/lib/pipe/csv.js +126 -113
  30. package/lib/pipe/debug.js +99 -118
  31. package/lib/pipe/github.js +213 -218
  32. package/lib/pipe/gitlab.js +206 -183
  33. package/lib/pipe/html.js +321 -258
  34. package/lib/pipe/index.js +66 -94
  35. package/lib/pipe/testomatio.js +474 -429
  36. package/lib/reporter-functions.js +26 -28
  37. package/lib/reporter.js +29 -34
  38. package/lib/services/artifacts.js +51 -55
  39. package/lib/services/index.js +12 -14
  40. package/lib/services/key-values.js +53 -56
  41. package/lib/services/logger.js +245 -226
  42. package/lib/template/testomatio.hbs +1366 -1026
  43. package/lib/uploader.js +364 -295
  44. package/lib/utils/pipe_utils.js +85 -89
  45. package/lib/utils/utils.js +307 -398
  46. package/lib/xmlReader.js +532 -525
  47. package/package.json +21 -64
  48. package/lib/adapter/codecept.d.ts +0 -2
  49. package/lib/adapter/cucumber/current.d.ts +0 -14
  50. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  51. package/lib/adapter/cucumber.d.ts +0 -2
  52. package/lib/adapter/cypress-plugin/index.d.ts +0 -2
  53. package/lib/adapter/jasmine.d.ts +0 -11
  54. package/lib/adapter/jest.d.ts +0 -13
  55. package/lib/adapter/mocha.d.ts +0 -2
  56. package/lib/adapter/nightwatch.d.ts +0 -4
  57. package/lib/adapter/nightwatch.js +0 -80
  58. package/lib/adapter/playwright.d.ts +0 -14
  59. package/lib/adapter/vitest.d.ts +0 -35
  60. package/lib/adapter/webdriver.d.ts +0 -24
  61. package/lib/bin/cli.d.ts +0 -2
  62. package/lib/bin/reportXml.d.ts +0 -2
  63. package/lib/bin/startTest.d.ts +0 -2
  64. package/lib/bin/uploadArtifacts.d.ts +0 -2
  65. package/lib/client.d.ts +0 -76
  66. package/lib/config.d.ts +0 -1
  67. package/lib/constants.d.ts +0 -25
  68. package/lib/data-storage.d.ts +0 -34
  69. package/lib/junit-adapter/adapter.d.ts +0 -9
  70. package/lib/junit-adapter/csharp.d.ts +0 -5
  71. package/lib/junit-adapter/index.d.ts +0 -3
  72. package/lib/junit-adapter/java.d.ts +0 -5
  73. package/lib/junit-adapter/javascript.d.ts +0 -4
  74. package/lib/junit-adapter/python.d.ts +0 -5
  75. package/lib/junit-adapter/ruby.d.ts +0 -4
  76. package/lib/output.d.ts +0 -11
  77. package/lib/package.json +0 -3
  78. package/lib/pipe/bitbucket.d.ts +0 -25
  79. package/lib/pipe/csv.d.ts +0 -47
  80. package/lib/pipe/debug.d.ts +0 -29
  81. package/lib/pipe/github.d.ts +0 -30
  82. package/lib/pipe/gitlab.d.ts +0 -25
  83. package/lib/pipe/html.d.ts +0 -35
  84. package/lib/pipe/index.d.ts +0 -1
  85. package/lib/pipe/testomatio.d.ts +0 -71
  86. package/lib/replay.d.ts +0 -31
  87. package/lib/replay.js +0 -237
  88. package/lib/reporter-functions.d.ts +0 -34
  89. package/lib/reporter.d.ts +0 -232
  90. package/lib/services/artifacts.d.ts +0 -33
  91. package/lib/services/index.d.ts +0 -9
  92. package/lib/services/key-values.d.ts +0 -27
  93. package/lib/services/logger.d.ts +0 -64
  94. package/lib/uploader.d.ts +0 -60
  95. package/lib/utils/pipe_utils.d.ts +0 -41
  96. package/lib/utils/utils.d.ts +0 -54
  97. package/lib/xmlReader.d.ts +0 -92
  98. package/src/adapter/codecept.js +0 -373
  99. package/src/adapter/cucumber/current.js +0 -228
  100. package/src/adapter/cucumber/legacy.js +0 -158
  101. package/src/adapter/cucumber.js +0 -4
  102. package/src/adapter/cypress-plugin/index.js +0 -110
  103. package/src/adapter/jasmine.js +0 -60
  104. package/src/adapter/jest.js +0 -107
  105. package/src/adapter/mocha.cjs +0 -2
  106. package/src/adapter/mocha.js +0 -156
  107. package/src/adapter/nightwatch.js +0 -88
  108. package/src/adapter/playwright.js +0 -254
  109. package/src/adapter/vitest.js +0 -183
  110. package/src/adapter/webdriver.js +0 -142
  111. package/src/bin/cli.js +0 -348
  112. package/src/bin/reportXml.js +0 -77
  113. package/src/bin/startTest.js +0 -124
  114. package/src/bin/uploadArtifacts.js +0 -91
  115. package/src/client.js +0 -508
  116. package/src/config.js +0 -30
  117. package/src/constants.js +0 -53
  118. package/src/data-storage.js +0 -204
  119. package/src/junit-adapter/adapter.js +0 -23
  120. package/src/junit-adapter/csharp.js +0 -28
  121. package/src/junit-adapter/index.js +0 -28
  122. package/src/junit-adapter/java.js +0 -58
  123. package/src/junit-adapter/javascript.js +0 -31
  124. package/src/junit-adapter/python.js +0 -42
  125. package/src/junit-adapter/ruby.js +0 -10
  126. package/src/output.js +0 -57
  127. package/src/pipe/bitbucket.js +0 -252
  128. package/src/pipe/csv.js +0 -140
  129. package/src/pipe/debug.js +0 -119
  130. package/src/pipe/github.js +0 -232
  131. package/src/pipe/gitlab.js +0 -247
  132. package/src/pipe/html.js +0 -373
  133. package/src/pipe/index.js +0 -71
  134. package/src/pipe/testomatio.js +0 -504
  135. package/src/replay.js +0 -245
  136. package/src/reporter-functions.js +0 -55
  137. package/src/reporter.cjs_decprecated +0 -21
  138. package/src/reporter.js +0 -33
  139. package/src/services/artifacts.js +0 -59
  140. package/src/services/index.js +0 -13
  141. package/src/services/key-values.js +0 -59
  142. package/src/services/logger.js +0 -315
  143. package/src/template/emptyData.svg +0 -23
  144. package/src/template/testomatio.hbs +0 -1081
  145. package/src/uploader.js +0 -376
  146. package/src/utils/pipe_utils.js +0 -119
  147. package/src/utils/utils.js +0 -416
  148. package/src/xmlReader.js +0 -614
package/src/replay.js DELETED
@@ -1,245 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import os from 'os';
4
- import TestomatClient from './client.js';
5
- import { STATUS } from './constants.js';
6
- import { config } from './config.js';
7
-
8
- export class Replay {
9
- constructor(options = {}) {
10
- this.apiKey = options.apiKey || config.TESTOMATIO || undefined;
11
- this.dryRun = options.dryRun || false;
12
- this.onProgress = options.onProgress || (() => {});
13
- this.onLog = options.onLog || console.log;
14
- this.onError = options.onError || console.error;
15
- }
16
-
17
- /**
18
- * Get the default debug file path
19
- * @returns {string} Path to the latest debug file
20
- */
21
- getDefaultDebugFile() {
22
- return path.join(os.tmpdir(), 'testomatio.debug.latest.json');
23
- }
24
-
25
- /**
26
- * Parse a debug file and extract test data
27
- * @param {string} debugFile - Path to the debug file
28
- * @returns {Object} Parsed debug data
29
- */
30
- parseDebugFile(debugFile) {
31
- if (!fs.existsSync(debugFile)) {
32
- throw new Error(`Debug file not found: ${debugFile}`);
33
- }
34
-
35
- const fileContent = fs.readFileSync(debugFile, 'utf-8');
36
- const lines = fileContent.trim().split('\n').filter(line => line.trim() !== '');
37
-
38
- if (lines.length === 0) {
39
- throw new Error('Debug file is empty');
40
- }
41
-
42
- let runParams = {};
43
- let finishParams = {};
44
- let parseErrors = 0;
45
- const testsMap = new Map(); // Use Map to deduplicate by rid
46
- const testsWithoutRid = []; // For tests without rid (backward compatibility)
47
- const envVars = {};
48
-
49
- // Parse debug file line by line
50
- for (const [lineIndex, line] of lines.entries()) {
51
- try {
52
- const logEntry = JSON.parse(line);
53
-
54
- if (logEntry.data === 'variables' && logEntry.testomatioEnvVars) {
55
- Object.assign(envVars, logEntry.testomatioEnvVars);
56
- } else if (logEntry.action === 'createRun') {
57
- runParams = logEntry.params || {};
58
- } else if (logEntry.action === 'addTestsBatch' && logEntry.tests) {
59
- // Process each test in the batch
60
- for (const test of logEntry.tests) {
61
- if (test.rid) {
62
- // Handle tests with rid (deduplicate)
63
- const existingTest = testsMap.get(test.rid);
64
- if (existingTest) {
65
- // Merge test data - prioritize non-null/non-empty values
66
- const mergedTest = { ...existingTest };
67
- Object.keys(test).forEach(key => {
68
- if (test[key] !== null && test[key] !== undefined) {
69
- if (key === 'files' && Array.isArray(test[key]) && test[key].length > 0) {
70
- // Merge files arrays
71
- mergedTest.files = [...(existingTest.files || []), ...test[key]];
72
- } else if (key === 'artifacts' && Array.isArray(test[key]) && test[key].length > 0) {
73
- // Merge artifacts arrays
74
- mergedTest.artifacts = [...(existingTest.artifacts || []), ...test[key]];
75
- } else if (existingTest[key] === null || existingTest[key] === undefined ||
76
- (Array.isArray(existingTest[key]) && existingTest[key].length === 0)) {
77
- // Use new value if existing is null/undefined/empty array
78
- mergedTest[key] = test[key];
79
- }
80
- }
81
- });
82
- testsMap.set(test.rid, mergedTest);
83
- } else {
84
- testsMap.set(test.rid, { ...test });
85
- }
86
- } else {
87
- // Handle tests without rid (no deduplication)
88
- testsWithoutRid.push({ ...test });
89
- }
90
- }
91
- } else if (logEntry.action === 'addTest' && logEntry.testId) {
92
- const test = logEntry.testId;
93
- if (test.rid) {
94
- // Handle tests with rid (deduplicate)
95
- const existingTest = testsMap.get(test.rid);
96
- if (existingTest) {
97
- // Merge with existing test
98
- const mergedTest = { ...existingTest, ...test };
99
- testsMap.set(test.rid, mergedTest);
100
- } else {
101
- testsMap.set(test.rid, { ...test });
102
- }
103
- } else {
104
- // Handle tests without rid (no deduplication)
105
- testsWithoutRid.push({ ...test });
106
- }
107
- } else if (logEntry.actions === 'finishRun') {
108
- finishParams = logEntry.params || {};
109
- }
110
- } catch (err) {
111
- parseErrors++;
112
- if (parseErrors <= 3) {
113
- // Only show first 3 parse errors
114
- this.onError(`Failed to parse line ${lineIndex + 1}: ${line.substring(0, 100)}...`);
115
- }
116
- }
117
- }
118
-
119
- if (parseErrors > 3) {
120
- this.onError(`${parseErrors - 3} more parse errors occurred`);
121
- }
122
-
123
- // Combine tests with rid and tests without rid
124
- const allTests = [...Array.from(testsMap.values()), ...testsWithoutRid];
125
-
126
- return {
127
- runParams,
128
- finishParams,
129
- tests: allTests,
130
- envVars,
131
- parseErrors,
132
- totalLines: lines.length
133
- };
134
- }
135
-
136
- /**
137
- * Restore environment variables from debug data
138
- * @param {Object} envVars - Environment variables to restore
139
- */
140
- restoreEnvironmentVariables(envVars) {
141
- // Only restore env vars that aren't already set (don't override current values)
142
- Object.keys(envVars).forEach(key => {
143
- if (process.env[key] === undefined || process.env[key] === '') {
144
- process.env[key] = envVars[key];
145
- }
146
- });
147
- }
148
-
149
- /**
150
- * Replay test data to Testomat.io
151
- * @param {string} debugFile - Path to debug file (optional, uses default if not provided)
152
- * @returns {Promise<Object>} Replay results
153
- */
154
- async replay(debugFile) {
155
- if (!debugFile) {
156
- debugFile = this.getDefaultDebugFile();
157
- }
158
-
159
- if (!this.apiKey) {
160
- throw new Error('TESTOMATIO API key not found. Set TESTOMATIO environment variable.');
161
- }
162
-
163
- this.onLog(`Replaying data from debug file: ${debugFile}`);
164
-
165
- // Parse the debug file
166
- const debugData = this.parseDebugFile(debugFile);
167
- const { runParams, finishParams, tests, envVars } = debugData;
168
-
169
- this.onLog(`Found ${tests.length} tests to replay`);
170
-
171
- if (tests.length === 0) {
172
- throw new Error('No test data found in debug file');
173
- }
174
-
175
- // Restore environment variables
176
- this.restoreEnvironmentVariables(envVars);
177
-
178
- if (this.dryRun) {
179
- return {
180
- success: true,
181
- testsCount: tests.length,
182
- runParams,
183
- finishParams,
184
- envVars,
185
- dryRun: true
186
- };
187
- }
188
-
189
- // Create client and restore the run
190
- const client = new TestomatClient({
191
- apiKey: this.apiKey,
192
- isBatchEnabled: true,
193
- ...runParams,
194
- });
195
-
196
- this.onLog('Publishing to run...');
197
- await client.createRun(runParams);
198
-
199
- // Send each test result
200
- let successCount = 0;
201
- let failureCount = 0;
202
-
203
- for (const [index, test] of tests.entries()) {
204
- try {
205
- await client.addTestRun(test.status, test);
206
- successCount++;
207
- this.onProgress({
208
- current: index + 1,
209
- total: tests.length,
210
- test,
211
- success: true
212
- });
213
- } catch (err) {
214
- failureCount++;
215
- this.onError(`Failed to send test ${index + 1}: ${err.message}`);
216
- this.onProgress({
217
- current: index + 1,
218
- total: tests.length,
219
- test,
220
- success: false,
221
- error: err.message
222
- });
223
- }
224
- }
225
-
226
- await client.updateRunStatus(finishParams.status || STATUS.FINISHED, finishParams.parallel || false);
227
-
228
- const result = {
229
- success: true,
230
- testsCount: tests.length,
231
- successCount,
232
- failureCount,
233
- runParams,
234
- finishParams,
235
- envVars,
236
- runId: client.runId
237
- };
238
-
239
- this.onLog(`Successfully replayed ${successCount}/${tests.length} tests from debug file`);
240
-
241
- return result;
242
- }
243
- }
244
-
245
- export default Replay;
@@ -1,55 +0,0 @@
1
- import { services } from './services/index.js';
2
-
3
- /**
4
- * Stores path to file as artifact and uploads it to the S3 storage
5
- * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
6
- */
7
- function saveArtifact(data, context = null) {
8
- if (process.env.IS_PLAYWRIGHT)
9
- throw new Error(`This function is not available in Playwright framework.
10
- /Playwright supports artifacts out of the box`);
11
- if (!data) return;
12
- services.artifacts.put(data, context);
13
- }
14
-
15
- /**
16
- * Attach log message(s) to the test report
17
- * @param string
18
- */
19
- function logMessage(...args) {
20
- if (process.env.IS_PLAYWRIGHT) throw new Error('This function is not available in Playwright framework');
21
- services.logger._templateLiteralLog(...args);
22
- }
23
-
24
- /**
25
- * Similar to "log" function but marks message in report as a step
26
- * @param {string} message
27
- */
28
- function addStep(message) {
29
- if (process.env.IS_PLAYWRIGHT)
30
- throw new Error('This function is not available in Playwright framework. Use playwright steps');
31
-
32
- services.logger.step(message);
33
- }
34
-
35
- /**
36
- * Add key-value pair(s) to the test report
37
- * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
38
- * @param {string?} value
39
- */
40
- function setKeyValue(keyValue, value = null) {
41
- if (process.env.IS_PLAYWRIGHT)
42
- throw new Error('This function is not available in Playwright framework. Use test tag instead.');
43
-
44
- if (typeof keyValue === 'string') {
45
- keyValue = { [keyValue]: value };
46
- }
47
- services.keyValues.put(keyValue);
48
- }
49
-
50
- export default {
51
- artifact: saveArtifact,
52
- log: logMessage,
53
- step: addStep,
54
- keyValue: setKeyValue,
55
- };
@@ -1,21 +0,0 @@
1
- // const _reporter = require('../lib/reporter.js');
2
-
3
-
4
- // /**
5
- // * @typedef {import('../lib/reporter-functions.js').saveArtifact} artifact
6
- // * @typedef {import('../lib/reporter-functions.js').log} log
7
- // * @typedef {import('../lib/reporter-functions.js').logger} logger
8
- // * @typedef {import('../lib/reporter-functions.js')} meta
9
- // * @typedef {import('../lib/reporter-functions.js')} step
10
- // *
11
- // * "Reporter" type which is object containing all types from the above
12
- // * @typedef {{artifact: artifact, log: log, logger: logger, meta: meta, step: step, }} Reporter
13
- // */
14
-
15
- // // const reporter = _reporter;
16
-
17
- // /**
18
- // * @type {Reporter}
19
- // */
20
- // const reporter = _reporter;
21
- // module.exports = reporter;
package/src/reporter.js DELETED
@@ -1,33 +0,0 @@
1
- // import TestomatClient from './client.js';
2
- // import * as TRConstants from './constants.js';
3
- import { services } from './services/index.js';
4
- import reporterFunctions from './reporter-functions.js';
5
-
6
- export const artifact = reporterFunctions.artifact;
7
- export const log = reporterFunctions.log;
8
- export const logger = services.logger;
9
- export const meta = reporterFunctions.keyValue;
10
- export const step = reporterFunctions.step;
11
-
12
- /**
13
- * @typedef {import('./reporter-functions.js')} artifact
14
- * @typedef {import('./reporter-functions.js')} log
15
- * @typedef {import('./services/index.js')} logger
16
- * @typedef {import('./reporter-functions.js')} meta
17
- * @typedef {import('./reporter-functions.js')} step
18
- */
19
- export default {
20
- /**
21
- * @deprecated Use `log` or `testomat.log`
22
- */
23
- testomatioLogger: services.logger,
24
-
25
- artifact: reporterFunctions.artifact,
26
- log: reporterFunctions.log,
27
- logger: services.logger,
28
- meta: reporterFunctions.keyValue,
29
- step: reporterFunctions.step,
30
-
31
- // TestomatClient,
32
- // TRConstants,
33
- };
@@ -1,59 +0,0 @@
1
- import createDebugMessages from 'debug';
2
- import { dataStorage } from '../data-storage.js';
3
-
4
- const debug = createDebugMessages('@testomatio/reporter:services-artifacts');
5
-
6
- /**
7
- * Artifact storage is supposed to store file paths
8
- */
9
- class ArtifactStorage {
10
- static #instance;
11
-
12
- /**
13
- * Singleton
14
- * @returns {ArtifactStorage}
15
- */
16
- static getInstance() {
17
- if (!this.#instance) {
18
- this.#instance = new ArtifactStorage();
19
- }
20
- return this.#instance;
21
- }
22
-
23
- /**
24
- * Stores path to file as artifact and uploads it to the S3 storage
25
- * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
26
- * @param {*} context testId or test title
27
- */
28
- put(data, context = null) {
29
- if (!data) return;
30
- debug('Save artifact:', data);
31
- dataStorage.putData('artifact', data, context);
32
- }
33
-
34
- /**
35
- * Returns list of artifacts to upload
36
- * @param {*} context testId or test context from test runner
37
- * @returns {(string | {path: string, type: string, name: string})[]}
38
- */
39
- get(context) {
40
- let artifacts = dataStorage.getData('artifact', context);
41
- if (!artifacts || !artifacts.length) return [];
42
-
43
- artifacts = artifacts.map(artifactData => {
44
- // artifact could be an object ({type, path, name} props) or string (just path)
45
- let artifact;
46
- try {
47
- artifact = JSON.parse(artifactData);
48
- } catch (e) {
49
- artifact = artifactData;
50
- }
51
- return artifact;
52
- });
53
- artifacts = artifacts.filter(artifact => !!artifact);
54
- debug(`Artifacts for test ${context}:`, artifacts);
55
- return artifacts.length ? artifacts : [];
56
- }
57
- }
58
-
59
- export const artifactStorage = ArtifactStorage.getInstance();
@@ -1,13 +0,0 @@
1
- import { logger } from './logger.js';
2
- import { artifactStorage } from './artifacts.js';
3
- import { keyValueStorage } from './key-values.js';
4
- import { dataStorage } from '../data-storage.js';
5
-
6
- export const services = {
7
- logger,
8
- artifacts: artifactStorage,
9
- keyValues: keyValueStorage,
10
- setContext: context => {
11
- dataStorage.setContext(context);
12
- },
13
- };
@@ -1,59 +0,0 @@
1
- import createDebugMessages from 'debug';
2
- import { dataStorage } from '../data-storage.js';
3
-
4
- const debug = createDebugMessages('@testomatio/reporter:services-key-value');
5
- class KeyValueStorage {
6
- static #instance;
7
-
8
- /**
9
- *
10
- * @returns {KeyValueStorage}
11
- */
12
- static getInstance() {
13
- if (!this.#instance) {
14
- this.#instance = new KeyValueStorage();
15
- }
16
- return this.#instance;
17
- }
18
-
19
- /**
20
- * Stores key-value pair and passes it to reporter
21
- * @param {{[key: string]: string}} keyValue - key-value pair(s) as object
22
- * @param {*} context - full test title
23
- */
24
- put(keyValue, context = null) {
25
- if (!keyValue) return;
26
- dataStorage.putData('keyvalue', keyValue, context);
27
- }
28
-
29
- #isKeyValueObject(smth) {
30
- return smth && typeof smth === 'object' && !Array.isArray(smth) && smth !== null;
31
- }
32
-
33
- /**
34
- * Returns key-values pairs for the test as object
35
- * @param {*} context testId or test context from test runner
36
- * @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
37
- */
38
- get(context = null) {
39
- const keyValuesList = dataStorage.getData('keyvalue', context);
40
- if (!keyValuesList || !keyValuesList?.length) return {};
41
-
42
- const keyValues = {};
43
- for (const keyValue of keyValuesList) {
44
- if (this.#isKeyValueObject(keyValue)) {
45
- Object.assign(keyValues, keyValue);
46
- } else if (typeof keyValue === 'string') {
47
- try {
48
- Object.assign(keyValues, JSON.parse(keyValue));
49
- } catch (e) {
50
- debug(`Error parsing key-values for test ${context}`, keyValue);
51
- }
52
- }
53
- }
54
-
55
- return keyValues;
56
- }
57
- }
58
-
59
- export const keyValueStorage = KeyValueStorage.getInstance();