-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dots.js
47 lines (37 loc) · 1.08 KB
/
dots.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var BaseReporter = require('./base')
var DotsReporter = function (formatError, reportSlow) {
BaseReporter.call(this, formatError, reportSlow)
var DOTS_WRAP = 80
this.onRunStart = function () {
this._browsers = []
this._dotsCount = 0
}
this.onBrowserStart = function (browser) {
this._browsers.push(browser)
}
this.writeCommonMsg = function (msg) {
if (this._dotsCount) {
this._dotsCount = 0
msg = '\n' + msg
}
this.write(msg)
}
this.specSuccess = function () {
this._dotsCount = (this._dotsCount + 1) % DOTS_WRAP
this.write(this._dotsCount ? '.' : '.\n')
}
this.onBrowserComplete = function (browser) {
this.writeCommonMsg(this.renderBrowser(browser) + '\n')
}
this.onRunComplete = function (browsers, results) {
if (browsers.length > 1 && !results.disconnected && !results.error) {
if (!results.failed) {
this.write(this.TOTAL_SUCCESS, results.success)
} else {
this.write(this.TOTAL_FAILED, results.failed, results.success)
}
}
}
}
// PUBLISH
module.exports = DotsReporter