@testomatio/reporter 2.7.8 → 2.7.9-beta.1-markdown

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/src/replay.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import os from 'os';
4
3
  import TestomatClient from './client.js';
5
- import { STATUS } from './constants.js';
4
+ import { STATUS, DEBUG_FILE } from './constants.js';
6
5
  import { config } from './config.js';
7
6
 
8
7
  export class Replay {
@@ -15,11 +14,12 @@ export class Replay {
15
14
  }
16
15
 
17
16
  /**
18
- * Get the default debug file path
17
+ * Get the default debug file path.
18
+ * Returns ./testomatio.debug.json (actual file in CI, symlink to tmp file in local).
19
19
  * @returns {string} Path to the latest debug file
20
20
  */
21
21
  getDefaultDebugFile() {
22
- return path.join(os.tmpdir(), 'testomatio.debug.latest.json');
22
+ return path.join(process.cwd(), `${DEBUG_FILE}.json`);
23
23
  }
24
24
 
25
25
  /**
@@ -119,8 +119,11 @@ export class Replay {
119
119
  // Handle tests without rid (no deduplication)
120
120
  testsWithoutRid.push({ ...test });
121
121
  }
122
- } else if (logEntry.actions === 'finishRun') {
122
+ } else if (logEntry.action === 'finishRun') {
123
123
  finishParams = logEntry.params || {};
124
+ if (logEntry.runId && !runId) {
125
+ runId = logEntry.runId;
126
+ }
124
127
  }
125
128
  } catch (err) {
126
129
  parseErrors++;
@@ -203,23 +206,28 @@ export class Replay {
203
206
  };
204
207
  }
205
208
 
206
- // Create client and restore the run
209
+ if (runId) {
210
+ this.onLog(`Using existing run ID: ${runId}`);
211
+ process.env.TESTOMATIO_RUN = runId;
212
+ } else {
213
+ this.onLog('Publishing to run...');
214
+ }
215
+ process.env.TESTOMATIO_REPLAY = '1';
216
+
207
217
  const client = new TestomatClient({
208
218
  apiKey: this.apiKey,
209
219
  isBatchEnabled: true,
210
220
  ...runParams,
221
+ ...(runId && { runId }),
211
222
  });
212
223
 
213
- // Use the stored runId if available, otherwise create a new run
214
224
  if (runId) {
215
- this.onLog(`Using existing run ID: ${runId}`);
216
225
  client.runId = runId;
217
- } else {
218
- this.onLog('Publishing to run...');
219
- await client.createRun(runParams);
226
+ client.pipeStore.runId = runId;
220
227
  }
221
228
 
222
- // Send each test result
229
+ await client.createRun(runParams);
230
+
223
231
  let successCount = 0;
224
232
  let failureCount = 0;
225
233
 
@@ -248,7 +256,9 @@ export class Replay {
248
256
 
249
257
  await client.updateRunStatus(finishParams.status || STATUS.FINISHED);
250
258
 
251
- const result = {
259
+ this.onLog(`Successfully replayed ${successCount}/${tests.length} tests from debug file`);
260
+
261
+ return {
252
262
  success: true,
253
263
  testsCount: tests.length,
254
264
  successCount,
@@ -258,10 +268,6 @@ export class Replay {
258
268
  envVars,
259
269
  runId: runId || client.runId,
260
270
  };
261
-
262
- this.onLog(`Successfully replayed ${successCount}/${tests.length} tests from debug file`);
263
-
264
- return result;
265
271
  }
266
272
  }
267
273
 
@@ -2242,7 +2242,6 @@
2242
2242
  <div class='env-var-item {{#unless this.isSet}}env-var-unset{{/unless}}'>
2243
2243
  <div class='env-var-info'>
2244
2244
  <div class='env-var-key'>{{@key}}</div>
2245
- <div class='env-var-description'>{{this.description}}</div>
2246
2245
  </div>
2247
2246
  <div class='env-var-value {{#unless this.isSet}}env-var-empty{{/unless}} {{#if this.isSensitive}}env-var-confidential{{/if}}'>
2248
2247
  {{#if this.isSensitive}}
@@ -2267,7 +2266,6 @@
2267
2266
  <div class='env-var-item {{#unless this.isSet}}env-var-unset{{/unless}}'>
2268
2267
  <div class='env-var-info'>
2269
2268
  <div class='env-var-key'>{{@key}}</div>
2270
- <div class='env-var-description'>{{this.description}}</div>
2271
2269
  </div>
2272
2270
  <div class='env-var-value {{#unless this.isSet}}env-var-empty{{/unless}} {{#if this.isSensitive}}env-var-confidential{{/if}}'>
2273
2271
  {{#if this.isSensitive}}
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+ import os from 'os';
3
+ import { DEBUG_FILE } from '../constants.js';
4
+
5
+ /**
6
+ * Get the debug file path(s).
7
+ *
8
+ * Always creates a timestamped file in tmp dir and a symlink in project root.
9
+ *
10
+ * @param {string} [suffix] - Optional suffix appended to the base name (e.g. 'replay').
11
+ * @returns {{root: string, tmp: string}} root path (symlink), tmp path (actual file)
12
+ */
13
+ export function getDebugFilePath(suffix = '') {
14
+ const dateTime = new Date().toISOString().slice(0, 19).replace(/[:.]/g, '-');
15
+ const baseName = suffix ? `${DEBUG_FILE}-${suffix}` : DEBUG_FILE;
16
+ return {
17
+ root: path.join(process.cwd(), `${baseName}.json`),
18
+ tmp: path.join(os.tmpdir(), `${baseName}.${dateTime}.json`),
19
+ };
20
+ }
package/types/types.d.ts CHANGED
@@ -231,6 +231,11 @@ export interface HtmlTestData extends TestData {
231
231
  };
232
232
  }
233
233
 
234
+ /**
235
+ * Extended test data for Markdown reporter.
236
+ */
237
+ export interface MarkdownTestData extends HtmlTestData {}
238
+
234
239
  /**
235
240
  * Object representing a result of a Run.
236
241
  */