pulsar/spec/jasmine-helper.coffee

34 lines
1.1 KiB
CoffeeScript
Raw Normal View History

module.exports.runSpecSuite = (specSuite, logErrors=true) ->
2013-09-20 00:51:53 +04:00
{$, $$} = require 'atom'
2013-09-17 22:47:00 +04:00
window[key] = value for key, value of require '../vendor/jasmine'
require 'jasmine-focused'
2013-09-18 01:54:33 +04:00
TimeReporter = require './time-reporter'
timeReporter = new TimeReporter()
if atom.getLoadSettings().exitWhenDone
{jasmineNode} = require 'jasmine-node/lib/jasmine-node/reporter'
reporter = new jasmineNode.TerminalReporter
print: (args...) ->
process.stderr.write(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")
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
else
2013-09-18 01:54:33 +04:00
AtomReporter = require './atom-reporter'
reporter = new AtomReporter()
2013-02-12 06:00:42 +04:00
require specSuite
jasmineEnv = jasmine.getEnv()
jasmineEnv.addReporter(reporter)
jasmineEnv.addReporter(timeReporter)
2013-02-02 02:13:09 +04:00
$('body').append $$ -> @div id: 'jasmine-content'
2013-02-02 02:13:09 +04:00
jasmineEnv.execute()