2012-08-27 01:29:46 +04:00
|
|
|
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'
|
|
|
|
|
2013-03-21 05:36:55 +04:00
|
|
|
require 'jasmine-focused'
|
2012-08-27 01:29:46 +04:00
|
|
|
|
2013-09-18 01:54:33 +04:00
|
|
|
TimeReporter = require './time-reporter'
|
2013-08-29 09:07:57 +04:00
|
|
|
timeReporter = new TimeReporter()
|
2012-08-27 01:29:46 +04:00
|
|
|
|
2013-08-29 02:52:49 +04:00
|
|
|
if atom.getLoadSettings().exitWhenDone
|
|
|
|
{jasmineNode} = require 'jasmine-node/lib/jasmine-node/reporter'
|
|
|
|
reporter = new jasmineNode.TerminalReporter
|
|
|
|
print: (args...) ->
|
|
|
|
process.stderr.write(args...)
|
|
|
|
onComplete: (runner) ->
|
2013-08-29 09:07:57 +04:00
|
|
|
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")
|
2013-08-29 02:52:49 +04:00
|
|
|
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
|
2012-08-27 01:29:46 +04:00
|
|
|
else
|
2013-09-18 01:54:33 +04:00
|
|
|
AtomReporter = require './atom-reporter'
|
2013-08-29 02:52:49 +04:00
|
|
|
reporter = new AtomReporter()
|
2013-02-12 06:00:42 +04:00
|
|
|
|
2012-08-27 01:29:46 +04:00
|
|
|
require specSuite
|
2013-08-29 02:52:49 +04:00
|
|
|
|
2012-08-27 01:29:46 +04:00
|
|
|
jasmineEnv = jasmine.getEnv()
|
|
|
|
jasmineEnv.addReporter(reporter)
|
2013-08-29 09:07:57 +04:00
|
|
|
jasmineEnv.addReporter(timeReporter)
|
2013-02-02 02:13:09 +04:00
|
|
|
|
2013-08-29 02:52:49 +04:00
|
|
|
$('body').append $$ -> @div id: 'jasmine-content'
|
2013-02-02 02:13:09 +04:00
|
|
|
|
2012-08-27 01:29:46 +04:00
|
|
|
jasmineEnv.execute()
|