testomatio-reporter-cli 2.8.6-beta-fix-xml-batch → 2.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testomatio-reporter-cli",
3
- "version": "2.8.6-beta-fix-xml-batch",
3
+ "version": "2.9.0",
4
4
  "description": "Yarn Berry compatible standalone CLI for @testomatio/reporter",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,6 +48,7 @@ if (MAJOR_VERSION === 3 && MINOR_VERSION < 7) {
48
48
 
49
49
  function CodeceptReporter(config) {
50
50
  const failedTests = [];
51
+ const reportedTestUids = new Set();
51
52
  let videos = [];
52
53
  let traces = [];
53
54
  const reportTestPromises = [];
@@ -161,6 +162,7 @@ function CodeceptReporter(config) {
161
162
  const error = hook?.ctx?.currentTest?.err;
162
163
 
163
164
  for (const test of suite.tests) {
165
+ reportedTestUids.add(test.uid);
164
166
  const reportTestPromise = client.addTestRun('failed', {
165
167
  ...stripExampleFromTitle(test.title),
166
168
  rid: test.uid,
@@ -197,9 +199,29 @@ function CodeceptReporter(config) {
197
199
  });
198
200
  });
199
201
 
202
+ event.dispatcher.on(event.test.skipped, test => {
203
+ const { uid, tags, title } = test.simplify();
204
+
205
+ if (uid && reportedTestUids.has(uid)) return;
206
+
207
+ services.setContext(null);
208
+
209
+ const reportTestPromise = client.addTestRun(STATUS.SKIPPED, {
210
+ ...stripExampleFromTitle(title),
211
+ rid: uid,
212
+ test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
213
+ suite_title: test.parent && stripTagsFromTitle(stripExampleFromTitle(test.parent.title).title),
214
+ time: test.duration,
215
+ meta: test.meta,
216
+ });
217
+ reportTestPromises.push(reportTestPromise);
218
+ reportedTestUids.add(uid);
219
+ });
220
+
200
221
  event.dispatcher.on(event.test.after, test => {
201
222
  const { uid, tags, title, artifacts } = test.simplify();
202
223
  const error = test.err || null;
224
+ reportedTestUids.add(uid);
203
225
  failedTests.push(uid || title);
204
226
  const testObj = getTestAndMessage(title);
205
227
  const files = buildArtifactFiles(artifacts);
@@ -211,8 +233,8 @@ function CodeceptReporter(config) {
211
233
 
212
234
  // Build step hierarchy with screenshot from screenshotOnFail
213
235
  const stepHierarchy = buildUnifiedStepHierarchy(
214
- test.steps,
215
- hookSteps,
236
+ test.steps,
237
+ hookSteps,
216
238
  screenshotOnFailPath
217
239
  );
218
240
 
@@ -261,9 +261,10 @@ class CoveragePipe { // or Changes for the future???
261
261
  */
262
262
  #getChangedFilesFromGit(cmd) {
263
263
  try {
264
+ // Capture stderr (instead of ignoring it) so Git's actual error is available for diagnostics
264
265
  const result = execSync(cmd, {
265
266
  encoding: 'utf-8',
266
- stdio: ['pipe', 'pipe', 'ignore']
267
+ stdio: ['pipe', 'pipe', 'pipe']
267
268
  });
268
269
 
269
270
  return result
@@ -272,16 +273,33 @@ class CoveragePipe { // or Changes for the future???
272
273
  .filter(Boolean);
273
274
  }
274
275
  catch (err) {
275
- const errorMessage = err.message || '';
276
- // Git edge: Not a git repository or other error
276
+ // Prefer Git's own stderr output, fall back to the generic error message
277
+ const gitOutput = (err.stderr || '').toString().trim();
278
+ const errorMessage = gitOutput || err.message || '';
279
+
280
+ // Git edge: Not a git repository
277
281
  if (errorMessage.includes('Not a git repository')) {
278
- log.error( '❌ Error: This folder is not a Git repository.');
282
+ log.error('❌ Error: This folder is not a Git repository.');
283
+ return [];
279
284
  }
280
- else {
281
- throw new Error(`❌ Git command failed ("${cmd}"):\n`, errorMessage);
285
+
286
+ // Git edge: the branch/ref to diff against is not available locally.
287
+ // This is common in CI, where a shallow checkout fetches only the current branch.
288
+ if (
289
+ errorMessage.includes('unknown revision') ||
290
+ errorMessage.includes('ambiguous argument') ||
291
+ errorMessage.includes('bad revision')
292
+ ) {
293
+ log.error(`❌ Git command failed ("${cmd}"):\n${errorMessage}`);
294
+ log.error(
295
+ `🔍 Branch "${this.branch}" was not found locally. ` +
296
+ `In CI this usually means a shallow checkout — fetch full history first, e.g. ` +
297
+ `actions/checkout with "fetch-depth: 0", or run "git fetch origin ${this.branch}:${this.branch}".`
298
+ );
299
+ return [];
282
300
  }
283
301
 
284
- return [];
302
+ throw new Error(`❌ Git command failed ("${cmd}"):\n${errorMessage}`);
285
303
  }
286
304
  }
287
305