mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
42 lines
1.3 KiB
CoffeeScript
42 lines
1.3 KiB
CoffeeScript
fs = require 'fs'
|
|
|
|
module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) ->
|
|
{$, $$} = require 'atom'
|
|
window[key] = value for key, value of require '../vendor/jasmine'
|
|
|
|
require 'jasmine-focused'
|
|
require 'jasmine-tagged'
|
|
|
|
TimeReporter = require './time-reporter'
|
|
timeReporter = new TimeReporter()
|
|
|
|
logStream = fs.createWriteStream(logFile, flags: 'w')
|
|
process.__defineGetter__ 'stdout', -> logStream
|
|
process.__defineGetter__ 'stderr', -> logStream
|
|
|
|
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
|
|
AtomReporter = require './atom-reporter'
|
|
reporter = new AtomReporter()
|
|
|
|
require specSuite
|
|
|
|
jasmineEnv = jasmine.getEnv()
|
|
jasmineEnv.addReporter(reporter)
|
|
jasmineEnv.addReporter(timeReporter)
|
|
jasmineEnv.setIncludedTags([process.platform])
|
|
|
|
$('body').append $$ -> @div id: 'jasmine-content'
|
|
|
|
jasmineEnv.execute()
|