UNPKG

558 BJavaScriptView Raw
1'use strict'
2
3class BrowserResult {
4 constructor (total = 0) {
5 this.startTime = Date.now()
6
7 this.total = total
8 this.skipped = this.failed = this.success = 0
9 this.netTime = this.totalTime = 0
10 this.disconnected = this.error = false
11 }
12
13 totalTimeEnd () {
14 this.totalTime = Date.now() - this.startTime
15 }
16
17 add (result) {
18 if (result.skipped) {
19 this.skipped++
20 } else if (result.success) {
21 this.success++
22 } else {
23 this.failed++
24 }
25
26 this.netTime += result.time
27 }
28}
29
30module.exports = BrowserResult