monocart-reporter 2.0.0 → 2.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.
@@ -32,17 +32,20 @@ const attachCoverageReport = async (data, testInfo, options = {}) => {
32
32
  await coverageReport.add(data);
33
33
  const coverageResults = await coverageReport.generate();
34
34
 
35
- // save report json
36
- const definition = Util.attachments.coverage;
37
- const reportPath = path.resolve(htmlDir, definition.reportFile);
38
- Util.writeJSONSync(reportPath, coverageResults);
39
-
40
- // save attachments html link
41
- testInfo.attachments.push({
42
- name: definition.name,
43
- contentType: definition.contentType,
44
- path: coverageResults.reportPath
45
- });
35
+ const reportPath = coverageResults.reportPath;
36
+ if (reportPath && fs.existsSync(reportPath)) {
37
+ // save report json
38
+ const definition = Util.attachments.coverage;
39
+ const reportJsonPath = path.resolve(htmlDir, definition.reportFile);
40
+ Util.writeJSONSync(reportJsonPath, coverageResults);
41
+
42
+ // save attachments html link
43
+ testInfo.attachments.push({
44
+ name: definition.name,
45
+ contentType: definition.contentType,
46
+ path: reportPath
47
+ });
48
+ }
46
49
 
47
50
  return coverageResults;
48
51
  };
@@ -101,12 +104,16 @@ const generateGlobalCoverageReport = async (reporterOptions) => {
101
104
 
102
105
  // console.log('global coverage report', report);
103
106
 
104
- return {
105
- global: true,
106
- type: 'coverage',
107
- name: coverageResults.name,
108
- path: coverageResults.reportPath
109
- };
107
+ const reportPath = coverageResults.reportPath;
108
+ if (reportPath && fs.existsSync(reportPath)) {
109
+ return {
110
+ global: true,
111
+ type: 'coverage',
112
+ name: coverageResults.name,
113
+ path: reportPath
114
+ };
115
+ }
116
+
110
117
  };
111
118
 
112
119
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-reporter",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A playwright test reporter. Shows suites/cases/steps with tree style, markdown annotations, custom columns/formatters/data collection visitors, console logs, style tags, send email.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "koa": "^2.14.2",
49
49
  "koa-static-resolver": "^1.0.4",
50
50
  "lz-utils": "^2.0.1",
51
- "monocart-coverage-reports": "^1.0.6",
51
+ "monocart-coverage-reports": "^1.0.7",
52
52
  "nodemailer": "^6.9.7",
53
53
  "open": "^9.1.0",
54
54
  "turbogrid": "^3.0.10"