Created
May 3, 2011 04:47
-
-
Save xenophy/952831 to your computer and use it in GitHub Desktop.
Jasmin Driver for hantomjs support Jasmine 1.0.2
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
if (phantom.state.length === 0) { | |
if (phantom.args.length !== 1) { | |
console.log('Usage: run-jasmine.js URL'); | |
phantom.exit(); | |
} else { | |
phantom.state = 'run-jasmine'; | |
phantom.open(phantom.args[0]); | |
} | |
} else { | |
window.setInterval(function () { | |
var list, el, desc, i, j; | |
if (document.body.querySelector('.finished-at')) { | |
console.log(document.body.querySelector('.description').innerText); | |
list = document.body.querySelectorAll('div.jasmine_reporter > div.suite.failed'); | |
for (i = 0; i < list.length; ++i) { | |
el = list[i]; | |
console.log(''); | |
console.log(''); | |
var specName = el.querySelector('.description').innerText; | |
console.log('[' + specName + ']'); | |
spec = el.querySelectorAll('.spec'); | |
for (j = 0; j < spec.length; ++j) { | |
var fail = spec[j].querySelector('div.resultMessage.fail'); | |
var desc = spec[j].querySelector('.description'); | |
if(fail) { | |
var line = ''; | |
for(k=0; k<desc.innerText.length; k++) { | |
line += '-'; | |
} | |
console.log(line); | |
console.log(desc.innerText); | |
console.log(line); | |
console.log(fail.innerText); | |
console.log(''); | |
} | |
} | |
} | |
phantom.exit(); | |
} | |
}, 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment