From 4c34c11c5d0150fe29fe690ffa7dd95d72003d28 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 8 Aug 2019 11:05:01 -0400 Subject: [PATCH] :fire: Remove unused TimeReporter class --- spec/jasmine-test-runner.coffee | 2 - spec/time-reporter.coffee | 69 --------------------------------- 2 files changed, 71 deletions(-) delete mode 100644 spec/time-reporter.coffee diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 5b8662c14..a6601e487 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -60,8 +60,6 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> promise = new Promise (resolve, reject) -> resolveWithExitCode = resolve jasmineEnv = jasmine.getEnv() jasmineEnv.addReporter(buildReporter({logFile, headless, resolveWithExitCode})) - TimeReporter = require './time-reporter' - jasmineEnv.addReporter(new TimeReporter()) if process.env.TEST_JUNIT_XML_PATH {JasmineJUnitReporter} = require './jasmine-junit-reporter' diff --git a/spec/time-reporter.coffee b/spec/time-reporter.coffee deleted file mode 100644 index 16943c18b..000000000 --- a/spec/time-reporter.coffee +++ /dev/null @@ -1,69 +0,0 @@ -_ = require 'underscore-plus' - -module.exports = -class TimeReporter extends jasmine.Reporter - - constructor: -> - window.timedSpecs = [] - window.timedSuites = {} - - window.logLongestSpec = => @logLongestSpecs(1) - window.logLongestSpecs = (number) => @logLongestSpecs(number) - window.logLongestSuite = => @logLongestSuites(1) - window.logLongestSuites = (number) => @logLongestSuites(number) - - logLongestSuites: (number=10, log) -> - return unless window.timedSuites.length > 0 - - log ?= (line) -> console.log(line) - log "Longest running suites:" - suites = _.map(window.timedSuites, (key, value) -> [value, key]) - for suite in _.sortBy(suites, (suite) -> -suite[1])[0...number] - time = Math.round(suite[1] / 100) / 10 - log " #{suite[0]} (#{time}s)" - undefined - - logLongestSpecs: (number=10, log) -> - return unless window.timedSpecs.length > 0 - - log ?= (line) -> console.log(line) - log "Longest running specs:" - for spec in _.sortBy(window.timedSpecs, (spec) -> -spec.time)[0...number] - time = Math.round(spec.time / 100) / 10 - log "#{spec.description} (#{time}s)" - undefined - - reportSpecStarting: (spec) -> - stack = [spec.description] - suite = spec.suite - while suite - stack.unshift suite.description - @suite = suite.description - suite = suite.parentSuite - - reducer = (memo, description, index) -> - if index is 0 - "#{description}" - else - "#{memo}\n#{_.multiplyString(' ', index)}#{description}" - @description = _.reduce(stack, reducer, '') - @time = Date.now() - - reportSpecResults: (spec) -> - return unless @time? and @description? - - duration = Date.now() - @time - - if duration > 0 - window.timedSpecs.push - description: @description - time: duration - fullName: spec.getFullName() - - if window.timedSuites[@suite] - window.timedSuites[@suite] += duration - else - window.timedSuites[@suite] = duration - - @time = null - @description = null