Created
January 30, 2013 10:49
-
-
Save benshimmin/4672400 to your computer and use it in GitHub Desktop.
Super simple example of using Jasmine with PhantomJS
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
[ | |
// 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