playwright-ctrf-json-reporter 0.0.14 → 0.0.15

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.
@@ -67,8 +67,10 @@ class GenerateCtrfReport {
67
67
  onEnd() {
68
68
  this.ctrfReport.results.summary.stop = Date.now();
69
69
  if (this.suite !== undefined) {
70
- this.processSuite(this.suite);
71
- this.ctrfReport.results.summary.suites = this.countSuites(this.suite);
70
+ if (this.suite.allTests().length > 0) {
71
+ this.processSuite(this.suite);
72
+ this.ctrfReport.results.summary.suites = this.countSuites(this.suite);
73
+ }
72
74
  }
73
75
  this.writeReportToFile(this.ctrfReport);
74
76
  }
@@ -81,9 +83,14 @@ class GenerateCtrfReport {
81
83
  }
82
84
  }
83
85
  processTest(testCase) {
86
+ if (testCase.results.length === 0) {
87
+ return;
88
+ }
84
89
  const latestResult = testCase.results[testCase.results.length - 1];
85
- this.updateCtrfTestResultsFromTestResult(testCase, latestResult, this.ctrfReport);
86
- this.updateSummaryFromTestResult(latestResult, this.ctrfReport);
90
+ if (latestResult !== undefined) {
91
+ this.updateCtrfTestResultsFromTestResult(testCase, latestResult, this.ctrfReport);
92
+ this.updateSummaryFromTestResult(latestResult, this.ctrfReport);
93
+ }
87
94
  }
88
95
  setFilename(filename) {
89
96
  if (filename.endsWith('.json')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ctrf-json-reporter",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "A Playwright JSON test reporter to create test results reports",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {