1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/usr/bin/env phantomjs
// reusable phantomjs script for running clojurescript.test tests
// see http://github.com/cemerick/clojurescript.test for more info
var p = require('webpage').create();
var sys = require('system');
p.injectJs(sys.args[1]);
p.onConsoleMessage = function (x) {
var line = x;
if (line !== "[NEWLINE]") {
console.log(line.replace(/\[NEWLINE\]/g, "\n"));
}
};
p.evaluate(function () {
cemerick.cljs.test.set_print_fn_BANG_(function(x) {
console.log(x.replace(/\n/g, "[NEWLINE]")); // since console.log *itself* adds a newline
});
});
var success = p.evaluate(function () {
var results = cemerick.cljs.test.run_all_tests();
console.log(results);
return cemerick.cljs.test.successful_QMARK_(results);
});
phantom.exit(success ? 0 : 1);
|