Created
March 19, 2010 14:11
-
-
Save sfentress/337533 to your computer and use it in GitHub Desktop.
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
load('./spec/support/env.rhino.js') | |
load('./spec/support/jquery.js') | |
load('./spec/lib/jspec.js') | |
load('./spec/lib/jspec.xhr.js') | |
load('./spec/lib/jspec.jquery.js') | |
load('lib/etorki.js') | |
load('spec/unit/spec.helper.js') | |
function reporter(results, options) { | |
var w = new java.io.FileWriter('test-reports/jspec.xml'); | |
w.write('<?xml version="1.0" encoding="UTF-8"?>\n'); | |
w.write('<testsuites>\n'); | |
JSpec.each(results.allSuites, function(suite) { | |
var attribs = { | |
name: suite.description, | |
tests: suite.specs.length, | |
assertions: 0, | |
failures: 0, | |
specs: 0 | |
}; | |
var content = JSpec.inject(suite.specs, '', function(content, spec) { | |
attribs.assertions += spec.assertions.length; | |
attribs.failures += spec.passed() ? 0 : 1; | |
attribs.specs += 1; | |
content += ' <testcase name="'+spec.description+'" assertions="'+spec.assertions.length+'"> \n'; | |
JSpec.each(spec.failures(), function(failure) { | |
content += ' <failure message="">' + failure.message + '</failure> \n' | |
}); | |
content += ' </testcase> \n'; | |
return content; | |
}); | |
w.write(' <testsuite'); | |
for (var key in attribs) { | |
w.write(' ' + key + '="' + attribs[key] + '"'); | |
} | |
w.write('>\n'); | |
w.write(content); | |
w.write(' </testsuite>\n'); | |
}); | |
w.write('</testsuites>\n'); | |
w.close(); | |
quit(results.stats.failures); | |
} | |
JSpec | |
.exec('spec/unit/spec.js') | |
.run({ reporter: reporter, fixturePath: 'spec/fixtures' }) | |
.report() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment