Created
October 26, 2012 17:44
-
-
Save tsgautier/3960191 to your computer and use it in GitHub Desktop.
Test runner for Mocha inside Meteor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc.on('exit', function (code, signal) { | |
if (signal) { | |
log_to_clients({'exit': 'Exited from signal: ' + signal}); | |
} else { | |
log_to_clients({'exit': 'Exited with code: ' + code}); | |
if (code >= 40) process.exit(code - 40); | |
} | |
on_exit_callback(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.startup -> | |
Meteor.test() | |
Meteor.finished = (failed) -> | |
process.exit 40 + failed | |
Meteor.test = -> | |
baseURL = Meteor.absoluteUrl() | |
require("coffee-script") | |
require("should") | |
glob = require("glob") | |
Mocha = require("mocha") | |
run = (kind, files, cb) -> | |
Mocha.reporters.Base.useColors = true | |
mocha = new Mocha reporter: "spec" | |
_.each files, (file) -> mocha.addFile file | |
console.log("Running #{kind} tests:") | |
mocha.run(cb).globals(["x"]) | |
test = (kind, cb) -> | |
glob "tests/#{kind}/*.coffee", (er, files) -> | |
if er? | |
console.log er | |
return | |
run(kind, files, cb) | |
test "unit", (failed) -> | |
Meteor.finished(failed) if process.env.METEOR_EXIT_ON_TEST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment