monocart-reporter 2.9.14 → 2.9.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.
package/lib/merge-data.js CHANGED
@@ -389,7 +389,7 @@ module.exports = async (reportDataList, userOptions = {}) => {
389
389
  // init outputDir
390
390
  const outputDir = path.dirname(outputFile);
391
391
  // clean
392
- Util.initDir(outputDir);
392
+ Util.initDir(outputDir, options.clean);
393
393
  // for attachment path handler
394
394
  options.outputDir = outputDir;
395
395
 
package/lib/utils/util.js CHANGED
@@ -145,13 +145,19 @@ const Util = {
145
145
  },
146
146
 
147
147
  // empty or create dir
148
- initDir: (dirPath) => {
149
- if (fs.existsSync(dirPath)) {
150
- Util.rmSync(dirPath);
148
+ initDir: (dirPath, clean) => {
149
+
150
+ if (clean) {
151
+ if (fs.existsSync(dirPath)) {
152
+ Util.rmSync(dirPath);
153
+ }
154
+ }
155
+
156
+ if (!fs.existsSync(dirPath)) {
157
+ fs.mkdirSync(dirPath, {
158
+ recursive: true
159
+ });
151
160
  }
152
- fs.mkdirSync(dirPath, {
153
- recursive: true
154
- });
155
161
  },
156
162
 
157
163
  getEOL: function(content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-reporter",
3
- "version": "2.9.14",
3
+ "version": "2.9.15",
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": {