mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
38 lines
942 B
CoffeeScript
38 lines
942 B
CoffeeScript
$ = require 'jquery'
|
|
_ = require 'underscore'
|
|
|
|
Pane = require 'pane'
|
|
File = require 'fs'
|
|
{activeWindow} = App = require 'app'
|
|
|
|
{CoffeeScript} = require 'coffee-script'
|
|
|
|
module.exports =
|
|
class TinyTest extends Pane
|
|
keymap:
|
|
'Command-Ctrl-T': 'runTests'
|
|
|
|
runTests: ->
|
|
_.map File.list(App.root + '/test'), @runTest
|
|
|
|
runTest: (path) ->
|
|
# Even though we already have the path, run it
|
|
# through resolve() so we might find the dev version.
|
|
path = require.resolve _.last path.split '/'
|
|
name = _.last path.split '/'
|
|
|
|
try
|
|
if /\.coffee$/.test path
|
|
eval CoffeeScript.compile File.read path
|
|
else
|
|
eval File.read path
|
|
console.log "all tests passed in #{name}"
|
|
catch e
|
|
if e.actual? and e.expected?
|
|
console.error "#{e.operator} test failed in #{name}:"
|
|
console.error e.actual
|
|
console.error "isn't"
|
|
console.error e.expected
|
|
else
|
|
throw e
|