@testomatio/reporter 2.11.0 → 2.12.0

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/lib/bin/cli.js CHANGED
@@ -84,6 +84,10 @@ program
84
84
  log_js_1.log.error(picocolors_1.default.red('Failed to create run on Testomat.io.'));
85
85
  process.exit(1);
86
86
  }
87
+ // tests are executed later, so report the run as pending with the tests it was scoped to:
88
+ // pipes add their report now and replace it when the run is finished
89
+ const plannedTests = (client.pipeStore.preparedTestIds || []).map(id => ({ test_id: id, title: id }));
90
+ await client.updateRunStatus('pending', { tests: plannedTests });
87
91
  // stdout carries ONLY the run id so it can be captured: RUN_ID=$(reporter start)
88
92
  console.log(runId);
89
93
  process.exit(0);
package/lib/client.d.ts CHANGED
@@ -64,11 +64,11 @@ export class Client {
64
64
  /**
65
65
  *
66
66
  * Updates the status of the current test run and finishes the run.
67
- * @param {'passed' | 'failed' | 'skipped' | 'finished'} status - The status of the current test run.
67
+ * @param {'passed' | 'failed' | 'skipped' | 'finished' | 'pending'} status - The status of the current test run.
68
68
  * @param {Partial<import('../types/types.js').RunData>} [params] - Additional run params (e.g. duration).
69
69
  * Must be one of "passed", "failed", or "finished"
70
70
  * @returns {Promise<any>} - A Promise that resolves when finishes the run.
71
71
  */
72
- updateRunStatus(status: "passed" | "failed" | "skipped" | "finished", params?: Partial<import("../types/types.js").RunData>): Promise<any>;
72
+ updateRunStatus(status: "passed" | "failed" | "skipped" | "finished" | "pending", params?: Partial<import("../types/types.js").RunData>): Promise<any>;
73
73
  }
74
74
  import { S3Uploader } from './uploader.js';
package/lib/client.js CHANGED
@@ -319,7 +319,7 @@ class Client {
319
319
  /**
320
320
  *
321
321
  * Updates the status of the current test run and finishes the run.
322
- * @param {'passed' | 'failed' | 'skipped' | 'finished'} status - The status of the current test run.
322
+ * @param {'passed' | 'failed' | 'skipped' | 'finished' | 'pending'} status - The status of the current test run.
323
323
  * @param {Partial<import('../types/types.js').RunData>} [params] - Additional run params (e.g. duration).
324
324
  * Must be one of "passed", "failed", or "finished"
325
325
  * @returns {Promise<any>} - A Promise that resolves when finishes the run.
package/lib/pipe/html.js CHANGED
@@ -216,7 +216,7 @@ class HtmlPipe {
216
216
  runUrl: this.store.runUrl || '',
217
217
  executionTime: testExecutionSumTime(aggregatedTests),
218
218
  executionDate: getCurrentDateTimeFormatted(),
219
- description: [runParams.description || this.store.coverageDescription || this.store.description, this.description]
219
+ description: [this.description, runParams.description || this.store.coverageDescription || this.store.description]
220
220
  .filter(Boolean)
221
221
  .join('\n\n') || '',
222
222
  configuration: buildDisplayConfiguration(this.configuration || this.store.configuration || runParams.configuration || null),
@@ -117,7 +117,7 @@ class MarkdownPipe {
117
117
  isParallel: runParams?.isParallel,
118
118
  executionTime: testExecutionSumTime(aggregated),
119
119
  executionDate: getCurrentDateTimeFormatted(),
120
- description: [runParams?.description || this.store.coverageDescription || this.store.description, this.description]
120
+ description: [this.description, runParams?.description || this.store.coverageDescription || this.store.description]
121
121
  .filter(Boolean)
122
122
  .join('\n\n') || '',
123
123
  configuration: this.configuration || this.store.configuration || runParams?.configuration || null,
@@ -247,8 +247,9 @@ class TestomatioPipe {
247
247
  suites: coverageConfiguration.suites?.map(id => id.replace(/^S/, '')) || [],
248
248
  };
249
249
  }
250
- // Run description: coverage-derived block (if any) with the user-provided TESTOMATIO_DESCRIPTION appended after it.
251
- const description = [coverageDescription, this.description].filter(Boolean).join('\n\n') || null;
250
+ // Run description: the user-provided TESTOMATIO_DESCRIPTION with the coverage-derived block
251
+ // (if any) added after it. Neither overrides the other.
252
+ const description = [this.description, coverageDescription].filter(Boolean).join('\n\n') || null;
252
253
  // Merge caller-supplied configuration (e.g. { exploratory: true }) into runParams.configuration.
253
254
  // Caller values win on key conflict; coverage-derived tests/suites lists are preserved when not overridden.
254
255
  if (params.configuration && typeof params.configuration === 'object') {
@@ -511,6 +512,9 @@ class TestomatioPipe {
511
512
  console.warn(`${constants_js_1.APP_PREFIX} ${errorMessage}`);
512
513
  }
513
514
  const { status } = params;
515
+ // a pending run was just created: nothing to update here, only other pipes report it
516
+ if (status === 'pending')
517
+ return;
514
518
  let status_event;
515
519
  if (status === constants_js_1.STATUS.FINISHED)
516
520
  status_event = 'finish';
@@ -121,6 +121,8 @@ function statusEmoji(status) {
121
121
  return '🔴';
122
122
  if (status === 'skipped')
123
123
  return '🟡';
124
+ if (status === 'pending')
125
+ return '🕐';
124
126
  return '';
125
127
  }
126
128
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
package/src/bin/cli.js CHANGED
@@ -87,6 +87,11 @@ program
87
87
  process.exit(1);
88
88
  }
89
89
 
90
+ // tests are executed later, so report the run as pending with the tests it was scoped to:
91
+ // pipes add their report now and replace it when the run is finished
92
+ const plannedTests = (client.pipeStore.preparedTestIds || []).map(id => ({ test_id: id, title: id }));
93
+ await client.updateRunStatus('pending', { tests: plannedTests });
94
+
90
95
  // stdout carries ONLY the run id so it can be captured: RUN_ID=$(reporter start)
91
96
  console.log(runId);
92
97
  process.exit(0);
package/src/client.js CHANGED
@@ -371,7 +371,7 @@ class Client {
371
371
  /**
372
372
  *
373
373
  * Updates the status of the current test run and finishes the run.
374
- * @param {'passed' | 'failed' | 'skipped' | 'finished'} status - The status of the current test run.
374
+ * @param {'passed' | 'failed' | 'skipped' | 'finished' | 'pending'} status - The status of the current test run.
375
375
  * @param {Partial<import('../types/types.js').RunData>} [params] - Additional run params (e.g. duration).
376
376
  * Must be one of "passed", "failed", or "finished"
377
377
  * @returns {Promise<any>} - A Promise that resolves when finishes the run.
package/src/pipe/html.js CHANGED
@@ -268,7 +268,7 @@ class HtmlPipe {
268
268
  executionTime: testExecutionSumTime(aggregatedTests),
269
269
  executionDate: getCurrentDateTimeFormatted(),
270
270
  description:
271
- [runParams.description || this.store.coverageDescription || this.store.description, this.description]
271
+ [this.description, runParams.description || this.store.coverageDescription || this.store.description]
272
272
  .filter(Boolean)
273
273
  .join('\n\n') || '',
274
274
  configuration: buildDisplayConfiguration(
@@ -140,7 +140,7 @@ class MarkdownPipe {
140
140
  executionTime: testExecutionSumTime(aggregated),
141
141
  executionDate: getCurrentDateTimeFormatted(),
142
142
  description:
143
- [runParams?.description || this.store.coverageDescription || this.store.description, this.description]
143
+ [this.description, runParams?.description || this.store.coverageDescription || this.store.description]
144
144
  .filter(Boolean)
145
145
  .join('\n\n') || '',
146
146
  configuration: this.configuration || this.store.configuration || runParams?.configuration || null,
@@ -279,8 +279,9 @@ class TestomatioPipe {
279
279
  suites: coverageConfiguration.suites?.map(id => id.replace(/^S/, '')) || [],
280
280
  };
281
281
  }
282
- // Run description: coverage-derived block (if any) with the user-provided TESTOMATIO_DESCRIPTION appended after it.
283
- const description = [coverageDescription, this.description].filter(Boolean).join('\n\n') || null;
282
+ // Run description: the user-provided TESTOMATIO_DESCRIPTION with the coverage-derived block
283
+ // (if any) added after it. Neither overrides the other.
284
+ const description = [this.description, coverageDescription].filter(Boolean).join('\n\n') || null;
284
285
 
285
286
  // Merge caller-supplied configuration (e.g. { exploratory: true }) into runParams.configuration.
286
287
  // Caller values win on key conflict; coverage-derived tests/suites lists are preserved when not overridden.
@@ -558,6 +559,9 @@ class TestomatioPipe {
558
559
 
559
560
  const { status } = params;
560
561
 
562
+ // a pending run was just created: nothing to update here, only other pipes report it
563
+ if (status === 'pending') return;
564
+
561
565
  let status_event;
562
566
 
563
567
  if (status === STATUS.FINISHED) status_event = 'finish';
@@ -117,6 +117,7 @@ function statusEmoji(status) {
117
117
  if (status === 'passed') return '🟢';
118
118
  if (status === 'failed') return '🔴';
119
119
  if (status === 'skipped') return '🟡';
120
+ if (status === 'pending') return '🕐';
120
121
  return '';
121
122
  }
122
123
 
package/types/types.d.ts CHANGED
@@ -289,6 +289,8 @@ export enum RunStatus {
289
289
  Passed = 'passed',
290
290
  Failed = 'failed',
291
291
  Finished = 'finished',
292
+ /** run created but not executed yet, reported by `reporter start` */
293
+ Pending = 'pending',
292
294
  }
293
295
 
294
296
  /** Batch upload strategy: