monocart-reporter 2.9.13 → 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.
@@ -31,6 +31,9 @@ module.exports = () => ({
31
31
  // normal or exclude-idle
32
32
  durationStrategy: null,
33
33
 
34
+ // {boolean} Indicates whether to clean previous files in output dir before generating report. Defaults to true.
35
+ clean: true,
36
+
34
37
  // global coverage settings for addCoverageReport API
35
38
  coverage: null,
36
39
  // coverage: {
package/lib/index.d.ts CHANGED
@@ -96,6 +96,9 @@ export type MonocartReporterOptions = {
96
96
  /** normal or exclude-idle */
97
97
  durationStrategy?: 'normal' | 'exclude-idle',
98
98
 
99
+ /** Indicates whether to clean previous files in output dir before generating report. Defaults to true. */
100
+ clean?: boolean;
101
+
99
102
  /** global coverage options: https://github.com/cenfun/monocart-reporter?#code-coverage-report
100
103
  * ```js
101
104
  * coverage: {
package/lib/index.js CHANGED
@@ -97,6 +97,10 @@ class MonocartReporter {
97
97
 
98
98
  cleanOutputDir() {
99
99
 
100
+ if (!this.options.clean) {
101
+ return;
102
+ }
103
+
100
104
  // after trends
101
105
  const outputDir = this.options.outputDir;
102
106
  if (!fs.existsSync(outputDir)) {
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