browser_result.js 539 B

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