monocart-reporter 2.9.12 → 2.9.14

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)) {
@@ -156,7 +160,8 @@ class MonocartReporter {
156
160
 
157
161
  addTestLog(test, log) {
158
162
  if (test && test.logs) {
159
- test.logs.push(log);
163
+ // log could be Buffer
164
+ test.logs.push(`${log}`);
160
165
  }
161
166
  }
162
167