Skip to content

Instantly share code, notes, and snippets.

@benshimmin
Created January 30, 2013 10:49
Show Gist options
  • Save benshimmin/4672400 to your computer and use it in GitHub Desktop.
Save benshimmin/4672400 to your computer and use it in GitHub Desktop.
Super simple example of using Jasmine with PhantomJS
[
// Jasmine itself
"lib/jasmine.js",
// a console reporter; this one works fine:
// http://code.google.com/p/phantomjs/source/browse/test/lib/jasmine-console.js
"lib/jasmine-console.js",
// your actual code
"src.js",
// your tests
"spec.js"
].forEach(function(file) {
phantom.injectJs(file);
});
var msg = function(m) {
console.log(m.replace("\n", ""));
};
var reporter = function(reporter) {
phantom.exit(reporter.results().failedCount);
};
var env = jasmine.getEnv();
env.addReporter(new jasmine.ConsoleReporter(msg, reporter, true));
env.updateInterval = 1000;
env.execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment