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

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 (152) hide show
  1. package/README.md +1 -0
  2. package/lib/adapter/codecept.d.ts +2 -0
  3. package/lib/adapter/codecept.js +297 -335
  4. package/lib/adapter/cucumber/current.d.ts +14 -0
  5. package/lib/adapter/cucumber/current.js +195 -203
  6. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  7. package/lib/adapter/cucumber/legacy.js +130 -155
  8. package/lib/adapter/cucumber.d.ts +2 -0
  9. package/lib/adapter/cucumber.js +5 -16
  10. package/lib/adapter/cypress-plugin/index.d.ts +2 -0
  11. package/lib/adapter/cypress-plugin/index.js +91 -105
  12. package/lib/adapter/jasmine.d.ts +11 -0
  13. package/lib/adapter/jasmine.js +54 -53
  14. package/lib/adapter/jest.d.ts +13 -0
  15. package/lib/adapter/jest.js +97 -99
  16. package/lib/adapter/mocha.d.ts +2 -0
  17. package/lib/adapter/mocha.js +112 -141
  18. package/lib/adapter/nightwatch.d.ts +4 -0
  19. package/lib/adapter/nightwatch.js +80 -0
  20. package/lib/adapter/playwright.d.ts +14 -0
  21. package/lib/adapter/playwright.js +208 -231
  22. package/lib/adapter/vitest.d.ts +35 -0
  23. package/lib/adapter/vitest.js +150 -149
  24. package/lib/adapter/webdriver.d.ts +24 -0
  25. package/lib/adapter/webdriver.js +144 -121
  26. package/lib/bin/cli.d.ts +2 -0
  27. package/lib/bin/cli.js +229 -211
  28. package/lib/bin/reportXml.d.ts +2 -0
  29. package/lib/bin/reportXml.js +51 -52
  30. package/lib/bin/startTest.d.ts +2 -0
  31. package/lib/bin/startTest.js +83 -95
  32. package/lib/bin/uploadArtifacts.d.ts +2 -0
  33. package/lib/bin/uploadArtifacts.js +56 -61
  34. package/lib/client.d.ts +76 -0
  35. package/lib/client.js +431 -465
  36. package/lib/config.d.ts +1 -0
  37. package/lib/config.js +18 -23
  38. package/lib/constants.d.ts +25 -0
  39. package/lib/constants.js +50 -44
  40. package/lib/data-storage.d.ts +34 -0
  41. package/lib/data-storage.js +216 -188
  42. package/lib/junit-adapter/adapter.d.ts +9 -0
  43. package/lib/junit-adapter/adapter.js +17 -20
  44. package/lib/junit-adapter/csharp.d.ts +5 -0
  45. package/lib/junit-adapter/csharp.js +28 -14
  46. package/lib/junit-adapter/index.d.ts +3 -0
  47. package/lib/junit-adapter/index.js +27 -25
  48. package/lib/junit-adapter/java.d.ts +5 -0
  49. package/lib/junit-adapter/java.js +41 -53
  50. package/lib/junit-adapter/javascript.d.ts +4 -0
  51. package/lib/junit-adapter/javascript.js +30 -27
  52. package/lib/junit-adapter/python.d.ts +5 -0
  53. package/lib/junit-adapter/python.js +38 -37
  54. package/lib/junit-adapter/ruby.d.ts +4 -0
  55. package/lib/junit-adapter/ruby.js +11 -8
  56. package/lib/output.d.ts +11 -0
  57. package/lib/output.js +44 -52
  58. package/lib/package.json +3 -0
  59. package/lib/pipe/bitbucket.d.ts +25 -0
  60. package/lib/pipe/bitbucket.js +223 -230
  61. package/lib/pipe/csv.d.ts +47 -0
  62. package/lib/pipe/csv.js +113 -126
  63. package/lib/pipe/debug.d.ts +29 -0
  64. package/lib/pipe/debug.js +125 -99
  65. package/lib/pipe/github.d.ts +30 -0
  66. package/lib/pipe/github.js +218 -213
  67. package/lib/pipe/gitlab.d.ts +25 -0
  68. package/lib/pipe/gitlab.js +183 -206
  69. package/lib/pipe/html.d.ts +35 -0
  70. package/lib/pipe/html.js +258 -321
  71. package/lib/pipe/index.d.ts +1 -0
  72. package/lib/pipe/index.js +94 -66
  73. package/lib/pipe/testomatio.d.ts +71 -0
  74. package/lib/pipe/testomatio.js +429 -474
  75. package/lib/replay.d.ts +31 -0
  76. package/lib/replay.js +255 -0
  77. package/lib/reporter-functions.d.ts +41 -0
  78. package/lib/reporter-functions.js +64 -26
  79. package/lib/reporter.d.ts +235 -0
  80. package/lib/reporter.js +37 -29
  81. package/lib/services/artifacts.d.ts +33 -0
  82. package/lib/services/artifacts.js +55 -51
  83. package/lib/services/index.d.ts +11 -0
  84. package/lib/services/index.js +16 -12
  85. package/lib/services/key-values.d.ts +27 -0
  86. package/lib/services/key-values.js +56 -53
  87. package/lib/services/labels.d.ts +22 -0
  88. package/lib/services/labels.js +62 -0
  89. package/lib/services/logger.d.ts +64 -0
  90. package/lib/services/logger.js +226 -245
  91. package/lib/template/testomatio.hbs +1026 -1366
  92. package/lib/uploader.d.ts +60 -0
  93. package/lib/uploader.js +295 -364
  94. package/lib/utils/pipe_utils.d.ts +41 -0
  95. package/lib/utils/pipe_utils.js +89 -85
  96. package/lib/utils/utils.d.ts +54 -0
  97. package/lib/utils/utils.js +398 -307
  98. package/lib/xmlReader.d.ts +92 -0
  99. package/lib/xmlReader.js +525 -532
  100. package/package.json +64 -21
  101. package/src/adapter/codecept.js +377 -0
  102. package/src/adapter/cucumber/current.js +228 -0
  103. package/src/adapter/cucumber/legacy.js +158 -0
  104. package/src/adapter/cucumber.js +4 -0
  105. package/src/adapter/cypress-plugin/index.js +110 -0
  106. package/src/adapter/jasmine.js +60 -0
  107. package/src/adapter/jest.js +107 -0
  108. package/src/adapter/mocha.cjs +2 -0
  109. package/src/adapter/mocha.js +156 -0
  110. package/src/adapter/nightwatch.js +88 -0
  111. package/src/adapter/playwright.js +258 -0
  112. package/src/adapter/vitest.js +183 -0
  113. package/src/adapter/webdriver.js +142 -0
  114. package/src/bin/cli.js +348 -0
  115. package/src/bin/reportXml.js +77 -0
  116. package/src/bin/startTest.js +124 -0
  117. package/src/bin/uploadArtifacts.js +91 -0
  118. package/src/client.js +519 -0
  119. package/src/config.js +30 -0
  120. package/src/constants.js +53 -0
  121. package/src/data-storage.js +204 -0
  122. package/src/junit-adapter/adapter.js +23 -0
  123. package/src/junit-adapter/csharp.js +28 -0
  124. package/src/junit-adapter/index.js +28 -0
  125. package/src/junit-adapter/java.js +58 -0
  126. package/src/junit-adapter/javascript.js +31 -0
  127. package/src/junit-adapter/python.js +42 -0
  128. package/src/junit-adapter/ruby.js +10 -0
  129. package/src/output.js +57 -0
  130. package/src/pipe/bitbucket.js +252 -0
  131. package/src/pipe/csv.js +140 -0
  132. package/src/pipe/debug.js +125 -0
  133. package/src/pipe/github.js +232 -0
  134. package/src/pipe/gitlab.js +247 -0
  135. package/src/pipe/html.js +373 -0
  136. package/src/pipe/index.js +71 -0
  137. package/src/pipe/testomatio.js +504 -0
  138. package/src/replay.js +262 -0
  139. package/src/reporter-functions.js +96 -0
  140. package/src/reporter.cjs_decprecated +21 -0
  141. package/src/reporter.js +36 -0
  142. package/src/services/artifacts.js +59 -0
  143. package/src/services/index.js +15 -0
  144. package/src/services/key-values.js +59 -0
  145. package/src/services/labels.js +59 -0
  146. package/src/services/logger.js +315 -0
  147. package/src/template/emptyData.svg +23 -0
  148. package/src/template/testomatio.hbs +1081 -0
  149. package/src/uploader.js +376 -0
  150. package/src/utils/pipe_utils.js +119 -0
  151. package/src/utils/utils.js +416 -0
  152. package/src/xmlReader.js +614 -0
@@ -0,0 +1,31 @@
1
+ export class Replay {
2
+ constructor(options?: {});
3
+ apiKey: any;
4
+ dryRun: any;
5
+ onProgress: any;
6
+ onLog: any;
7
+ onError: any;
8
+ /**
9
+ * Get the default debug file path
10
+ * @returns {string} Path to the latest debug file
11
+ */
12
+ getDefaultDebugFile(): string;
13
+ /**
14
+ * Parse a debug file and extract test data
15
+ * @param {string} debugFile - Path to the debug file
16
+ * @returns {Object} Parsed debug data
17
+ */
18
+ parseDebugFile(debugFile: string): any;
19
+ /**
20
+ * Restore environment variables from debug data
21
+ * @param {Object} envVars - Environment variables to restore
22
+ */
23
+ restoreEnvironmentVariables(envVars: any): void;
24
+ /**
25
+ * Replay test data to Testomat.io
26
+ * @param {string} debugFile - Path to debug file (optional, uses default if not provided)
27
+ * @returns {Promise<Object>} Replay results
28
+ */
29
+ replay(debugFile: string): Promise<any>;
30
+ }
31
+ export default Replay;
package/lib/replay.js ADDED
@@ -0,0 +1,255 @@
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.Replay = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const client_js_1 = __importDefault(require("./client.js"));
11
+ const constants_js_1 = require("./constants.js");
12
+ const config_js_1 = require("./config.js");
13
+ class Replay {
14
+ constructor(options = {}) {
15
+ this.apiKey = options.apiKey || config_js_1.config.TESTOMATIO || undefined;
16
+ this.dryRun = options.dryRun || false;
17
+ this.onProgress = options.onProgress || (() => { });
18
+ this.onLog = options.onLog || console.log;
19
+ this.onError = options.onError || console.error;
20
+ }
21
+ /**
22
+ * Get the default debug file path
23
+ * @returns {string} Path to the latest debug file
24
+ */
25
+ getDefaultDebugFile() {
26
+ return path_1.default.join(os_1.default.tmpdir(), 'testomatio.debug.latest.json');
27
+ }
28
+ /**
29
+ * Parse a debug file and extract test data
30
+ * @param {string} debugFile - Path to the debug file
31
+ * @returns {Object} Parsed debug data
32
+ */
33
+ parseDebugFile(debugFile) {
34
+ if (!fs_1.default.existsSync(debugFile)) {
35
+ throw new Error(`Debug file not found: ${debugFile}`);
36
+ }
37
+ const fileContent = fs_1.default.readFileSync(debugFile, 'utf-8');
38
+ const lines = fileContent.trim().split('\n').filter(line => line.trim() !== '');
39
+ if (lines.length === 0) {
40
+ throw new Error('Debug file is empty');
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
+ let runId = null;
49
+ // Parse debug file line by line
50
+ for (const [lineIndex, line] of lines.entries()) {
51
+ try {
52
+ const logEntry = JSON.parse(line);
53
+ if (logEntry.data === 'variables' && logEntry.testomatioEnvVars) {
54
+ Object.assign(envVars, logEntry.testomatioEnvVars);
55
+ }
56
+ else if (logEntry.action === 'createRun') {
57
+ runParams = logEntry.params || {};
58
+ }
59
+ else if (logEntry.action === 'addTestsBatch' && logEntry.tests) {
60
+ // Extract runId if available
61
+ if (logEntry.runId && !runId) {
62
+ runId = logEntry.runId;
63
+ }
64
+ // Process each test in the batch
65
+ for (const test of logEntry.tests) {
66
+ if (test.rid) {
67
+ // Handle tests with rid (deduplicate)
68
+ const existingTest = testsMap.get(test.rid);
69
+ if (existingTest) {
70
+ // Merge test data - prioritize non-null/non-empty values
71
+ const mergedTest = { ...existingTest };
72
+ Object.keys(test).forEach(key => {
73
+ if (test[key] !== null && test[key] !== undefined) {
74
+ if (key === 'files' && Array.isArray(test[key]) && test[key].length > 0) {
75
+ // Merge files arrays
76
+ mergedTest.files = [...(existingTest.files || []), ...test[key]];
77
+ }
78
+ else if (key === 'artifacts' && Array.isArray(test[key]) && test[key].length > 0) {
79
+ // Merge artifacts arrays
80
+ mergedTest.artifacts = [...(existingTest.artifacts || []), ...test[key]];
81
+ }
82
+ else if (existingTest[key] === null || existingTest[key] === undefined ||
83
+ (Array.isArray(existingTest[key]) && existingTest[key].length === 0)) {
84
+ // Use new value if existing is null/undefined/empty array
85
+ mergedTest[key] = test[key];
86
+ }
87
+ }
88
+ });
89
+ testsMap.set(test.rid, mergedTest);
90
+ }
91
+ else {
92
+ testsMap.set(test.rid, { ...test });
93
+ }
94
+ }
95
+ else {
96
+ // Handle tests without rid (no deduplication)
97
+ testsWithoutRid.push({ ...test });
98
+ }
99
+ }
100
+ }
101
+ else if (logEntry.action === 'addTest' && logEntry.testId) {
102
+ // Extract runId if available
103
+ if (logEntry.runId && !runId) {
104
+ runId = logEntry.runId;
105
+ }
106
+ const test = logEntry.testId;
107
+ if (test.rid) {
108
+ // Handle tests with rid (deduplicate)
109
+ const existingTest = testsMap.get(test.rid);
110
+ if (existingTest) {
111
+ // Merge with existing test
112
+ const mergedTest = { ...existingTest, ...test };
113
+ testsMap.set(test.rid, mergedTest);
114
+ }
115
+ else {
116
+ testsMap.set(test.rid, { ...test });
117
+ }
118
+ }
119
+ else {
120
+ // Handle tests without rid (no deduplication)
121
+ testsWithoutRid.push({ ...test });
122
+ }
123
+ }
124
+ else if (logEntry.actions === 'finishRun') {
125
+ finishParams = logEntry.params || {};
126
+ }
127
+ }
128
+ catch (err) {
129
+ parseErrors++;
130
+ if (parseErrors <= 3) {
131
+ // Only show first 3 parse errors
132
+ this.onError(`Failed to parse line ${lineIndex + 1}: ${line.substring(0, 100)}...`);
133
+ }
134
+ }
135
+ }
136
+ if (parseErrors > 3) {
137
+ this.onError(`${parseErrors - 3} more parse errors occurred`);
138
+ }
139
+ // Combine tests with rid and tests without rid
140
+ const allTests = [...Array.from(testsMap.values()), ...testsWithoutRid];
141
+ return {
142
+ runParams,
143
+ finishParams,
144
+ tests: allTests,
145
+ envVars,
146
+ parseErrors,
147
+ totalLines: lines.length,
148
+ runId
149
+ };
150
+ }
151
+ /**
152
+ * Restore environment variables from debug data
153
+ * @param {Object} envVars - Environment variables to restore
154
+ */
155
+ restoreEnvironmentVariables(envVars) {
156
+ // Only restore env vars that aren't already set (don't override current values)
157
+ Object.keys(envVars).forEach(key => {
158
+ if (process.env[key] === undefined || process.env[key] === '') {
159
+ process.env[key] = envVars[key];
160
+ }
161
+ });
162
+ }
163
+ /**
164
+ * Replay test data to Testomat.io
165
+ * @param {string} debugFile - Path to debug file (optional, uses default if not provided)
166
+ * @returns {Promise<Object>} Replay results
167
+ */
168
+ async replay(debugFile) {
169
+ if (!debugFile) {
170
+ debugFile = this.getDefaultDebugFile();
171
+ }
172
+ if (!this.apiKey) {
173
+ throw new Error('TESTOMATIO API key not found. Set TESTOMATIO environment variable.');
174
+ }
175
+ this.onLog(`Replaying data from debug file: ${debugFile}`);
176
+ // Parse the debug file
177
+ const debugData = this.parseDebugFile(debugFile);
178
+ const { runParams, finishParams, tests, envVars, runId } = debugData;
179
+ this.onLog(`Found ${tests.length} tests to replay`);
180
+ if (tests.length === 0) {
181
+ throw new Error('No test data found in debug file');
182
+ }
183
+ // Restore environment variables
184
+ this.restoreEnvironmentVariables(envVars);
185
+ if (this.dryRun) {
186
+ return {
187
+ success: true,
188
+ testsCount: tests.length,
189
+ runParams,
190
+ finishParams,
191
+ envVars,
192
+ runId,
193
+ dryRun: true
194
+ };
195
+ }
196
+ // Create client and restore the run
197
+ const client = new client_js_1.default({
198
+ apiKey: this.apiKey,
199
+ isBatchEnabled: true,
200
+ ...runParams,
201
+ });
202
+ // Use the stored runId if available, otherwise create a new run
203
+ if (runId) {
204
+ this.onLog(`Using existing run ID: ${runId}`);
205
+ client.runId = runId;
206
+ }
207
+ else {
208
+ this.onLog('Publishing to run...');
209
+ await client.createRun(runParams);
210
+ }
211
+ // Send each test result
212
+ let successCount = 0;
213
+ let failureCount = 0;
214
+ for (const [index, test] of tests.entries()) {
215
+ try {
216
+ await client.addTestRun(test.status, test);
217
+ successCount++;
218
+ this.onProgress({
219
+ current: index + 1,
220
+ total: tests.length,
221
+ test,
222
+ success: true
223
+ });
224
+ }
225
+ catch (err) {
226
+ failureCount++;
227
+ this.onError(`Failed to send test ${index + 1}: ${err.message}`);
228
+ this.onProgress({
229
+ current: index + 1,
230
+ total: tests.length,
231
+ test,
232
+ success: false,
233
+ error: err.message
234
+ });
235
+ }
236
+ }
237
+ await client.updateRunStatus(finishParams.status || constants_js_1.STATUS.FINISHED, finishParams.parallel || false);
238
+ const result = {
239
+ success: true,
240
+ testsCount: tests.length,
241
+ successCount,
242
+ failureCount,
243
+ runParams,
244
+ finishParams,
245
+ envVars,
246
+ runId: runId || client.runId
247
+ };
248
+ this.onLog(`Successfully replayed ${successCount}/${tests.length} tests from debug file`);
249
+ return result;
250
+ }
251
+ }
252
+ exports.Replay = Replay;
253
+ module.exports = Replay;
254
+
255
+ module.exports.Replay = Replay;
@@ -0,0 +1,41 @@
1
+ declare namespace _default {
2
+ export { saveArtifact as artifact };
3
+ export { logMessage as log };
4
+ export { addStep as step };
5
+ export { setKeyValue as keyValue };
6
+ export { setLabel as label };
7
+ }
8
+ export default _default;
9
+ /**
10
+ * Stores path to file as artifact and uploads it to the S3 storage
11
+ * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
12
+ */
13
+ declare function saveArtifact(data: string | {
14
+ path: string;
15
+ type: string;
16
+ name: string;
17
+ }, context?: any): void;
18
+ /**
19
+ * Attach log message(s) to the test report
20
+ * @param string
21
+ */
22
+ declare function logMessage(...args: any[]): void;
23
+ /**
24
+ * Similar to "log" function but marks message in report as a step
25
+ * @param {string} message
26
+ */
27
+ declare function addStep(message: string): void;
28
+ /**
29
+ * Add key-value pair(s) to the test report
30
+ * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
31
+ * @param {string?} value
32
+ */
33
+ declare function setKeyValue(keyValue: {
34
+ [key: string]: string;
35
+ } | string, value?: string | null): void;
36
+ /**
37
+ * Add a single label to the test report
38
+ * @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
39
+ * @param {string} [value] - optional label value (e.g. 'high', 'login')
40
+ */
41
+ declare function setLabel(key: string, value?: string): void;
@@ -1,50 +1,88 @@
1
- const { services } = require('./services');
2
- const { initPlaywrightForStorage } = require('./adapter/playwright');
3
-
4
- if (process.env.PLAYWRIGHT_TEST_BASE_URL) {
5
- initPlaywrightForStorage();
6
- }
7
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./services/index.js");
8
4
  /**
9
5
  * Stores path to file as artifact and uploads it to the S3 storage
10
6
  * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
11
7
  */
12
8
  function saveArtifact(data, context = null) {
13
- if (!data) return;
14
- services.artifacts.put(data, context);
9
+ if (process.env.IS_PLAYWRIGHT)
10
+ throw new Error(`This function is not available in Playwright framework.
11
+ /Playwright supports artifacts out of the box`);
12
+ if (!data)
13
+ return;
14
+ index_js_1.services.artifacts.put(data, context);
15
15
  }
16
-
17
16
  /**
18
17
  * Attach log message(s) to the test report
19
- * @param {...any} args
18
+ * @param string
20
19
  */
21
20
  function logMessage(...args) {
22
- services.logger._templateLiteralLog(...args);
21
+ if (process.env.IS_PLAYWRIGHT)
22
+ throw new Error('This function is not available in Playwright framework');
23
+ index_js_1.services.logger._templateLiteralLog(...args);
23
24
  }
24
-
25
25
  /**
26
26
  * Similar to "log" function but marks message in report as a step
27
- * @param {*} message
27
+ * @param {string} message
28
28
  */
29
29
  function addStep(message) {
30
- services.logger.step(message);
30
+ if (process.env.IS_PLAYWRIGHT)
31
+ throw new Error('This function is not available in Playwright framework. Use playwright steps');
32
+ index_js_1.services.logger.step(message);
31
33
  }
32
-
33
34
  /**
34
35
  * Add key-value pair(s) to the test report
35
- * @param {*} keyValue or key
36
+ * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
36
37
  * @param {string?} value
37
38
  */
38
39
  function setKeyValue(keyValue, value = null) {
39
- if (value && typeof keyValue === 'string') {
40
- keyValue = { [keyValue]: value };
41
- }
42
- services.keyValues.put(keyValue);
40
+ if (process.env.IS_PLAYWRIGHT)
41
+ throw new Error('This function is not available in Playwright framework. Use test tag instead.');
42
+ if (typeof keyValue === 'string') {
43
+ keyValue = { [keyValue]: value };
44
+ }
45
+ index_js_1.services.keyValues.put(keyValue);
46
+ }
47
+ /**
48
+ * Add a single label to the test report
49
+ * @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
50
+ * @param {string} [value] - optional label value (e.g. 'high', 'login')
51
+ */
52
+ function setLabel(key, value = null) {
53
+ if (!key || typeof key !== 'string') {
54
+ console.warn('Label key must be a non-empty string');
55
+ return;
56
+ }
57
+ // Limit key length to 255 characters
58
+ if (key.length > 255) {
59
+ console.warn('Label key is too long, trimmed to 255 characters:', key);
60
+ key = key.substring(0, 255);
61
+ }
62
+ let labelString = key;
63
+ if (value !== null && value !== undefined && value !== '') {
64
+ if (typeof value !== 'string') {
65
+ console.warn('Label value must be a string, converting:', value);
66
+ value = String(value);
67
+ }
68
+ // Limit value length to 255 characters
69
+ if (value.length > 255) {
70
+ console.warn('Label value is too long, trimmed to 255 characters:', value);
71
+ value = value.substring(0, 255);
72
+ }
73
+ labelString = `${key}:${value}`;
74
+ }
75
+ // Limit total label length to 255 characters
76
+ if (labelString.length > 255) {
77
+ console.warn('Label is too long, trimmed to 255 characters:', labelString);
78
+ labelString = labelString.substring(0, 255);
79
+ }
80
+ index_js_1.services.labels.put([labelString]);
43
81
  }
44
-
45
82
  module.exports = {
46
- artifact: saveArtifact,
47
- log: logMessage,
48
- step: addStep,
49
- keyValue: setKeyValue,
83
+ artifact: saveArtifact,
84
+ log: logMessage,
85
+ step: addStep,
86
+ keyValue: setKeyValue,
87
+ label: setLabel,
50
88
  };
@@ -0,0 +1,235 @@
1
+ export type artifact = typeof import("./reporter-functions.js");
2
+ export const artifact: (data: string | {
3
+ path: string;
4
+ type: string;
5
+ name: string;
6
+ }, context?: any) => void;
7
+ export type log = typeof import("./reporter-functions.js");
8
+ export const log: (...args: any[]) => void;
9
+ export type logger = typeof import("./services/index.js");
10
+ export const logger: {
11
+ "__#13@#originalUserLogger": {
12
+ assert(condition?: boolean, ...data: any[]): void;
13
+ assert(value: any, message?: string, ...optionalParams: any[]): void;
14
+ clear(): void;
15
+ clear(): void;
16
+ count(label?: string): void;
17
+ count(label?: string): void;
18
+ countReset(label?: string): void;
19
+ countReset(label?: string): void;
20
+ debug(...data: any[]): void;
21
+ debug(message?: any, ...optionalParams: any[]): void;
22
+ dir(item?: any, options?: any): void;
23
+ dir(obj: any, options?: import("util").InspectOptions): void;
24
+ dirxml(...data: any[]): void;
25
+ dirxml(...data: any[]): void;
26
+ error(...data: any[]): void;
27
+ error(message?: any, ...optionalParams: any[]): void;
28
+ group(...data: any[]): void;
29
+ group(...label: any[]): void;
30
+ groupCollapsed(...data: any[]): void;
31
+ groupCollapsed(...label: any[]): void;
32
+ groupEnd(): void;
33
+ groupEnd(): void;
34
+ info(...data: any[]): void;
35
+ info(message?: any, ...optionalParams: any[]): void;
36
+ log(...data: any[]): void;
37
+ log(message?: any, ...optionalParams: any[]): void;
38
+ table(tabularData?: any, properties?: string[]): void;
39
+ table(tabularData: any, properties?: readonly string[]): void;
40
+ time(label?: string): void;
41
+ time(label?: string): void;
42
+ timeEnd(label?: string): void;
43
+ timeEnd(label?: string): void;
44
+ timeLog(label?: string, ...data: any[]): void;
45
+ timeLog(label?: string, ...data: any[]): void;
46
+ timeStamp(label?: string): void;
47
+ timeStamp(label?: string): void;
48
+ trace(...data: any[]): void;
49
+ trace(message?: any, ...optionalParams: any[]): void;
50
+ warn(...data: any[]): void;
51
+ warn(message?: any, ...optionalParams: any[]): void;
52
+ Console: console.ConsoleConstructor;
53
+ profile(label?: string): void;
54
+ profileEnd(label?: string): void;
55
+ };
56
+ "__#13@#userLoggerWithOverridenMethods": any;
57
+ logLevel: string;
58
+ step(strings: any, ...values: any[]): void;
59
+ getLogs(context: string): string[];
60
+ "__#13@#stringifyLogs"(...args: any[]): string;
61
+ _templateLiteralLog(strings: any, ...args: any[]): void;
62
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
63
+ assert(...args: any[]): void;
64
+ debug(...args: any[]): void;
65
+ error(...args: any[]): void;
66
+ info(...args: any[]): void;
67
+ log(...args: any[]): void;
68
+ trace(...args: any[]): void;
69
+ warn(...args: any[]): void;
70
+ intercept(userLogger: any): void;
71
+ stopInterception(): void;
72
+ configure(config?: {
73
+ logLevel?: string;
74
+ prettyObjects?: boolean;
75
+ }): void;
76
+ prettyObjects: boolean;
77
+ };
78
+ export type meta = typeof import("./reporter-functions.js");
79
+ export const meta: (keyValue: {
80
+ [key: string]: string;
81
+ } | string, value?: string | null) => void;
82
+ export type step = typeof import("./reporter-functions.js");
83
+ export const step: (message: string) => void;
84
+ export type label = typeof import("./reporter-functions.js");
85
+ export const label: (key: string, value?: string) => void;
86
+ declare namespace _default {
87
+ let testomatioLogger: {
88
+ "__#13@#originalUserLogger": {
89
+ assert(condition?: boolean, ...data: any[]): void;
90
+ assert(value: any, message?: string, ...optionalParams: any[]): void;
91
+ clear(): void;
92
+ clear(): void;
93
+ count(label?: string): void;
94
+ count(label?: string): void;
95
+ countReset(label?: string): void;
96
+ countReset(label?: string): void;
97
+ debug(...data: any[]): void;
98
+ debug(message?: any, ...optionalParams: any[]): void;
99
+ dir(item?: any, options?: any): void;
100
+ dir(obj: any, options?: import("util").InspectOptions): void;
101
+ dirxml(...data: any[]): void;
102
+ dirxml(...data: any[]): void;
103
+ error(...data: any[]): void;
104
+ error(message?: any, ...optionalParams: any[]): void;
105
+ group(...data: any[]): void;
106
+ group(...label: any[]): void;
107
+ groupCollapsed(...data: any[]): void;
108
+ groupCollapsed(...label: any[]): void;
109
+ groupEnd(): void;
110
+ groupEnd(): void;
111
+ info(...data: any[]): void;
112
+ info(message?: any, ...optionalParams: any[]): void;
113
+ log(...data: any[]): void;
114
+ log(message?: any, ...optionalParams: any[]): void;
115
+ table(tabularData?: any, properties?: string[]): void;
116
+ table(tabularData: any, properties?: readonly string[]): void;
117
+ time(label?: string): void;
118
+ time(label?: string): void;
119
+ timeEnd(label?: string): void;
120
+ timeEnd(label?: string): void;
121
+ timeLog(label?: string, ...data: any[]): void;
122
+ timeLog(label?: string, ...data: any[]): void;
123
+ timeStamp(label?: string): void;
124
+ timeStamp(label?: string): void;
125
+ trace(...data: any[]): void;
126
+ trace(message?: any, ...optionalParams: any[]): void;
127
+ warn(...data: any[]): void;
128
+ warn(message?: any, ...optionalParams: any[]): void;
129
+ Console: console.ConsoleConstructor;
130
+ profile(label?: string): void;
131
+ profileEnd(label?: string): void;
132
+ };
133
+ "__#13@#userLoggerWithOverridenMethods": any;
134
+ logLevel: string;
135
+ step(strings: any, ...values: any[]): void;
136
+ getLogs(context: string): string[];
137
+ "__#13@#stringifyLogs"(...args: any[]): string;
138
+ _templateLiteralLog(strings: any, ...args: any[]): void;
139
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
140
+ assert(...args: any[]): void;
141
+ debug(...args: any[]): void;
142
+ error(...args: any[]): void;
143
+ info(...args: any[]): void;
144
+ log(...args: any[]): void;
145
+ trace(...args: any[]): void;
146
+ warn(...args: any[]): void;
147
+ intercept(userLogger: any): void;
148
+ stopInterception(): void;
149
+ configure(config?: {
150
+ logLevel?: string;
151
+ prettyObjects?: boolean;
152
+ }): void;
153
+ prettyObjects: boolean;
154
+ };
155
+ let artifact: (data: string | {
156
+ path: string;
157
+ type: string;
158
+ name: string;
159
+ }, context?: any) => void;
160
+ let log: (...args: any[]) => void;
161
+ let logger: {
162
+ "__#13@#originalUserLogger": {
163
+ assert(condition?: boolean, ...data: any[]): void;
164
+ assert(value: any, message?: string, ...optionalParams: any[]): void;
165
+ clear(): void;
166
+ clear(): void;
167
+ count(label?: string): void;
168
+ count(label?: string): void;
169
+ countReset(label?: string): void;
170
+ countReset(label?: string): void;
171
+ debug(...data: any[]): void;
172
+ debug(message?: any, ...optionalParams: any[]): void;
173
+ dir(item?: any, options?: any): void;
174
+ dir(obj: any, options?: import("util").InspectOptions): void;
175
+ dirxml(...data: any[]): void;
176
+ dirxml(...data: any[]): void;
177
+ error(...data: any[]): void;
178
+ error(message?: any, ...optionalParams: any[]): void;
179
+ group(...data: any[]): void;
180
+ group(...label: any[]): void;
181
+ groupCollapsed(...data: any[]): void;
182
+ groupCollapsed(...label: any[]): void;
183
+ groupEnd(): void;
184
+ groupEnd(): void;
185
+ info(...data: any[]): void;
186
+ info(message?: any, ...optionalParams: any[]): void;
187
+ log(...data: any[]): void;
188
+ log(message?: any, ...optionalParams: any[]): void;
189
+ table(tabularData?: any, properties?: string[]): void;
190
+ table(tabularData: any, properties?: readonly string[]): void;
191
+ time(label?: string): void;
192
+ time(label?: string): void;
193
+ timeEnd(label?: string): void;
194
+ timeEnd(label?: string): void;
195
+ timeLog(label?: string, ...data: any[]): void;
196
+ timeLog(label?: string, ...data: any[]): void;
197
+ timeStamp(label?: string): void;
198
+ timeStamp(label?: string): void;
199
+ trace(...data: any[]): void;
200
+ trace(message?: any, ...optionalParams: any[]): void;
201
+ warn(...data: any[]): void;
202
+ warn(message?: any, ...optionalParams: any[]): void;
203
+ Console: console.ConsoleConstructor;
204
+ profile(label?: string): void;
205
+ profileEnd(label?: string): void;
206
+ };
207
+ "__#13@#userLoggerWithOverridenMethods": any;
208
+ logLevel: string;
209
+ step(strings: any, ...values: any[]): void;
210
+ getLogs(context: string): string[];
211
+ "__#13@#stringifyLogs"(...args: any[]): string;
212
+ _templateLiteralLog(strings: any, ...args: any[]): void;
213
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
214
+ assert(...args: any[]): void;
215
+ debug(...args: any[]): void;
216
+ error(...args: any[]): void;
217
+ info(...args: any[]): void;
218
+ log(...args: any[]): void;
219
+ trace(...args: any[]): void;
220
+ warn(...args: any[]): void;
221
+ intercept(userLogger: any): void;
222
+ stopInterception(): void;
223
+ configure(config?: {
224
+ logLevel?: string;
225
+ prettyObjects?: boolean;
226
+ }): void;
227
+ prettyObjects: boolean;
228
+ };
229
+ let meta: (keyValue: {
230
+ [key: string]: string;
231
+ } | string, value?: string | null) => void;
232
+ let step: (message: string) => void;
233
+ let label: (key: string, value?: string) => void;
234
+ }
235
+ export default _default;