vitest-qase-reporter 1.0.0 → 1.0.1

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/changelog.md ADDED
@@ -0,0 +1,6 @@
1
+ # qase-vitest@1.0.1
2
+
3
+ ## What's new
4
+
5
+ - Added support for status filter in the test run.
6
+ - Improved error handling.
package/dist/index.d.ts CHANGED
@@ -24,10 +24,6 @@ export declare class VitestQaseReporter implements Reporter {
24
24
  */
25
25
  private static removeQaseIdsFromTitle;
26
26
  constructor(options?: VitestQaseOptionsType);
27
- /**
28
- * Convert Vitest test result status to Qase TestStatusEnum
29
- */
30
- private convertStatus;
31
27
  /**
32
28
  * Create TestResultType from Vitest TestCase
33
29
  */
package/dist/index.js CHANGED
@@ -40,23 +40,6 @@ class VitestQaseReporter {
40
40
  reporterName: 'vitest-qase-reporter',
41
41
  });
42
42
  }
43
- /**
44
- * Convert Vitest test result status to Qase TestStatusEnum
45
- */
46
- convertStatus(result) {
47
- switch (result.state) {
48
- case 'passed':
49
- return qase_javascript_commons_1.TestStatusEnum.passed;
50
- case 'failed':
51
- return qase_javascript_commons_1.TestStatusEnum.failed;
52
- case 'skipped':
53
- return qase_javascript_commons_1.TestStatusEnum.skipped;
54
- case 'pending':
55
- return qase_javascript_commons_1.TestStatusEnum.skipped;
56
- default:
57
- return qase_javascript_commons_1.TestStatusEnum.skipped;
58
- }
59
- }
60
43
  /**
61
44
  * Create TestResultType from Vitest TestCase
62
45
  */
@@ -92,11 +75,19 @@ class VitestQaseReporter {
92
75
  });
93
76
  }
94
77
  // Set execution details
95
- testResult.execution.status = this.convertStatus(result);
96
78
  testResult.execution.start_time = diagnostic?.startTime ? diagnostic.startTime / 1000 : null;
97
79
  testResult.execution.end_time = diagnostic?.startTime ? diagnostic.startTime / 1000 + diagnostic.duration : null;
98
80
  testResult.execution.duration = Math.round(diagnostic?.duration || 0);
81
+ // Create error object for status determination
82
+ let error = null;
99
83
  if (result?.errors && result.errors.length > 0) {
84
+ const firstError = result.errors[0];
85
+ if (firstError && typeof firstError === 'object' && 'message' in firstError) {
86
+ error = new Error(String(firstError.message));
87
+ if ('stack' in firstError && firstError.stack) {
88
+ error.stack = String(firstError.stack);
89
+ }
90
+ }
100
91
  testResult.execution.stacktrace = result.errors.map((error) => {
101
92
  if (error && typeof error === 'object' && 'stack' in error && 'message' in error) {
102
93
  return error.stack ?? error.message ?? String(error);
@@ -107,6 +98,8 @@ class VitestQaseReporter {
107
98
  ? String(result.errors[0].message) ?? 'Test failed'
108
99
  : 'Test failed';
109
100
  }
101
+ // Determine status based on error type
102
+ testResult.execution.status = (0, qase_javascript_commons_1.determineTestStatus)(error, result.state);
110
103
  if (result.state === 'skipped') {
111
104
  testResult.message = result && typeof result === 'object' && 'note' in result ? result.note ?? null : null;
112
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-qase-reporter",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Qase TMS Vitest Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "author": "Qase Team <support@qase.io>",
41
41
  "license": "Apache-2.0",
42
42
  "dependencies": {
43
- "qase-javascript-commons": "~2.4.1"
43
+ "qase-javascript-commons": "~2.4.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "vitest": ">=3.0.0"