@testomatio/reporter 2.0.0-beta.3-xml → 2.0.0-beta.4-xml

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
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.0.0-beta.3-xml",
3
+ "version": "v2.0.0-beta.4-xml",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
package/src/pipe/debug.js CHANGED
@@ -92,9 +92,9 @@ export class DebugPipe {
92
92
 
93
93
  async finishRun(params) {
94
94
  if (!this.isEnabled) return;
95
- this.logToFile({ actions: 'finishRun', params });
96
95
  await this.batchUpload();
97
96
  if (this.batch.intervalFunction) clearInterval(this.batch.intervalFunction);
97
+ this.logToFile({ actions: 'finishRun', params });
98
98
  console.log(APP_PREFIX, '🪲. Debug Saved to', this.logFilePath);
99
99
  }
100
100
 
@@ -10,7 +10,9 @@ import { fileURLToPath } from 'url';
10
10
  const debug = createDebugMessages('@testomatio/reporter:util');
11
11
 
12
12
  // Use __dirname directly since we're compiling to CommonJS
13
- const __dirname = path.resolve();
13
+ // @ts-ignore - import.meta is only available in ESM
14
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
15
+ const __dirname = typeof global.__dirname !== 'undefined' ? global.__dirname : currentDir;
14
16
 
15
17
  /**
16
18
  * @param {String} testTitle - Test title
package/src/xmlReader.js CHANGED
@@ -495,7 +495,7 @@ function reduceTestCases(prev, item) {
495
495
  const preferClassname = reduceOptions.preferClassname || isParametrized;
496
496
 
497
497
  // SpecFlow config
498
- let { title, tags } = fetchProperties(isParametrized ? item : testCaseItem);
498
+ let { title, tags, testId } = fetchProperties(isParametrized ? item : testCaseItem);
499
499
  let example = null;
500
500
  const suiteTitle = preferClassname ? testCaseItem.classname : item.name || testCaseItem.classname;
501
501
 
@@ -511,7 +511,8 @@ function reduceTestCases(prev, item) {
511
511
  stack = `${
512
512
  testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''
513
513
  }\n\n${stack}\n\n${suiteOutput}\n\n${suiteErr}`.trim();
514
- let testId = fetchIdFromOutput(stack);
514
+
515
+ if (!testId) testId = fetchIdFromOutput(stack);
515
516
 
516
517
  if (tags?.length && !testId) {
517
518
  testId = tags.filter(t => t.startsWith('T')).map(t => `@${t}`).find(t => t.match(TEST_ID_REGEX))?.slice(2);
@@ -594,8 +595,14 @@ function fetchProperties(item) {
594
595
  const prop = properties.find(p => p.name === 'Description');
595
596
  if (prop) title = prop.value;
596
597
 
598
+ let testId = properties.find(p => p.name === 'ID')?.value;
599
+
600
+ if (testId?.startsWith('@')) testId = testId.slice(1);
601
+ if (testId?.startsWith('T')) testId = testId.slice(1);
602
+
597
603
  properties
598
604
  .filter(p => p.name === 'Category')
599
605
  .forEach(p => tags.push(p.value));
600
- return { title, tags };
606
+
607
+ return { title, tags, testId };
601
608
  }