Another attempt at preventing clipping

This commit is contained in:
Matt Colyer 2013-12-18 17:12:12 -08:00
parent 6736b6af3e
commit 40630114e7

View File

@ -10,21 +10,23 @@ module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) ->
TimeReporter = require './time-reporter'
timeReporter = new TimeReporter()
if logFile?
logStream = fs.createWriteStream(logFile, flags: 'w')
process.__defineGetter__ 'stdout', -> logStream
process.__defineGetter__ 'stderr', -> logStream
logStream = fs.openSync(logFile, 'w') if logFile?
log = (args...) ->
if logStream?
fs.writeSync(args...)
else
process.stderr.write(args...)
if atom.getLoadSettings().exitWhenDone
{jasmineNode} = require 'jasmine-node/lib/jasmine-node/reporter'
reporter = new jasmineNode.TerminalReporter
print: (args...) ->
process.stderr.write(args...)
log(args...)
onComplete: (runner) ->
process.stdout.write('\n')
timeReporter.logLongestSuites 10, (line) -> process.stdout.write("#{line}\n")
process.stdout.write('\n')
timeReporter.logLongestSpecs 10, (line) -> process.stdout.write("#{line}\n")
log('\n')
timeReporter.logLongestSuites 10, (line) -> log("#{line}\n")
log('\n')
timeReporter.logLongestSpecs 10, (line) -> log("#{line}\n")
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
else
AtomReporter = require './atom-reporter'