mirror of
https://github.com/atom/atom.git
synced 2026-01-14 17:38:03 -05:00
Add spec duration to mouseover summary
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
{View, $$} = require 'space-pen'
|
||||
_ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class AtomReporter extends View
|
||||
@@ -68,6 +69,8 @@ class AtomReporter extends View
|
||||
|
||||
clearTimeout @timeoutId if @timeoutId?
|
||||
@specPopup.show()
|
||||
spec = _.find(window.timedSpecs, (spec) -> description is spec.name)
|
||||
description = "#{description} #{spec.time}ms" if spec
|
||||
@specPopup.text description
|
||||
{left, top} = element.offset()
|
||||
left += 20
|
||||
|
||||
@@ -3,21 +3,23 @@ _ = require 'underscore'
|
||||
module.exports =
|
||||
class TimeReporter extends jasmine.Reporter
|
||||
|
||||
timedSpecs: []
|
||||
timedSuites: {}
|
||||
|
||||
constructor: ->
|
||||
window.timedSpecs = []
|
||||
window.timedSuites = {}
|
||||
|
||||
window.logLongestSpec = -> window.logLongestSpecs(1)
|
||||
|
||||
window.logLongestSpecs = (number=10) =>
|
||||
console.log "#{number} longest running specs:"
|
||||
for spec in _.sortBy(@timedSpecs, (spec) -> -spec.time)[0...number]
|
||||
for spec in _.sortBy(window.timedSpecs, (spec) -> -spec.time)[0...number]
|
||||
console.log "#{spec.time}ms"
|
||||
console.log spec.description
|
||||
|
||||
window.logLongestSuite = -> window.logLongestSuites(1)
|
||||
|
||||
window.logLongestSuites = (number=10) =>
|
||||
console.log "#{number} longest running suites:"
|
||||
suites = _.map(@timedSuites, (key, value) -> [value, key])
|
||||
suites = _.map(window.timedSuites, (key, value) -> [value, key])
|
||||
for suite in _.sortBy(suites, (suite) => -suite[1])[0...number]
|
||||
console.log suite[0], suite[1]
|
||||
|
||||
@@ -34,16 +36,17 @@ class TimeReporter extends jasmine.Reporter
|
||||
"#{memo}#{_.multiplyString(' ', index)}#{description}\n"
|
||||
@description = _.reduce(stack, reducer, "")
|
||||
|
||||
reportSpecResults: ->
|
||||
reportSpecResults: (spec) ->
|
||||
return unless @time? and @description?
|
||||
|
||||
duration = new Date().getTime() - @time
|
||||
@timedSpecs.push
|
||||
window.timedSpecs.push
|
||||
description: @description
|
||||
time: duration
|
||||
if @timedSuites[@suite]
|
||||
@timedSuites[@suite] += duration
|
||||
name: spec.getFullName()
|
||||
if timedSuites[@suite]
|
||||
window.timedSuites[@suite] += duration
|
||||
else
|
||||
@timedSuites[@suite] = duration
|
||||
window.timedSuites[@suite] = duration
|
||||
@time = null
|
||||
@description = null
|
||||
|
||||
Reference in New Issue
Block a user