Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / karma / lib / reporters / progress.js
1 var BaseReporter = require('./base')
2
3 var ProgressReporter = function (formatError, reportSlow) {
4   BaseReporter.call(this, formatError, reportSlow)
5
6   this.writeCommonMsg = function (msg) {
7     this.write(this._remove() + msg + this._render())
8   }
9
10   this.specSuccess = function () {
11     this.write(this._refresh())
12   }
13
14   this.onBrowserComplete = function () {
15     this.write(this._refresh())
16   }
17
18   this.onRunStart = function () {
19     this._browsers = []
20     this._isRendered = false
21   }
22
23   this.onBrowserStart = function (browser) {
24     this._browsers.push(browser)
25
26     if (this._isRendered) {
27       this.write('\n')
28     }
29
30     this.write(this._refresh())
31   }
32
33   this._remove = function () {
34     if (!this._isRendered) {
35       return ''
36     }
37
38     var cmd = ''
39     this._browsers.forEach(function () {
40       cmd += '\x1B[1A' + '\x1B[2K'
41     })
42
43     this._isRendered = false
44
45     return cmd
46   }
47
48   this._render = function () {
49     this._isRendered = true
50
51     return this._browsers.map(this.renderBrowser).join('\n') + '\n'
52   }
53
54   this._refresh = function () {
55     return this._remove() + this._render()
56   }
57 }
58
59 // PUBLISH
60 module.exports = ProgressReporter