monocart-reporter 2.8.3 → 2.8.4

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/index.js CHANGED
@@ -55,23 +55,26 @@ class MonocartReporter {
55
55
  this.tickTime = this.options.tickTime || 1000;
56
56
  this.tickStart();
57
57
 
58
+ // read trends from json before clean dir
59
+ getTrends(this.options.trend).then((trends) => {
60
+ // console.log('=========================== ', 'trends', trends.length);
61
+ this.trends = trends;
62
+ });
63
+
58
64
  this.init();
65
+
59
66
  }
60
67
 
61
68
  async init() {
62
69
 
63
70
  this.options.cwd = Util.formatPath(process.cwd());
64
71
 
65
- // read trends from json before clean dir
66
- this.trends = await getTrends(this.options.trend);
67
-
68
72
  // init outputDir
69
73
  const outputFile = await Util.resolveOutputFile(this.options.outputFile);
70
74
  this.options.outputFile = outputFile;
71
75
 
72
76
  const outputDir = path.dirname(outputFile);
73
77
 
74
- Util.initDir(outputDir);
75
78
  // for visitor relative path of attachments
76
79
  this.options.outputDir = outputDir;
77
80
 
@@ -85,6 +88,14 @@ class MonocartReporter {
85
88
  this.bindFunctions(stateOptions);
86
89
  this.stateServer = createStateServer(stateOptions);
87
90
  }
91
+
92
+ this.cleanOutputDir();
93
+
94
+ }
95
+
96
+ cleanOutputDir() {
97
+ Util.initDir(this.options.outputDir);
98
+ // console.log('=========================== ', 'cleanOutputDir');
88
99
  }
89
100
 
90
101
  // ==========================================================================
@@ -139,6 +150,8 @@ class MonocartReporter {
139
150
  this.config = config;
140
151
  this.root = suite;
141
152
 
153
+ // console.log('=========================== ', 'onBegin');
154
+
142
155
  // output dir for test results (not reporter)
143
156
  this.options.testOutputDir = config.projects[0].outputDir;
144
157
  // console.log(`onBegin: ${suite.allTests().length} tests`);