This branch is for Jasmine 2.x. Switch to the 1.x branch.
Jasmine Reporters is a collection of javascript jasmine reporter classes that can be used with the JasmineBDD testing framework.
Included reporters:
- AppVeyor - POSTs results to AppVeyor when running inside an AppVeyor environment.
- JUnitXmlReporter - Report test results to a file in JUnit XML Report format.
- NUnitXmlReporter - Report test results to a file in NUnit XML Report format.
- TapReporter - Test Anything Protocol, report tests results to console.
- TeamCityReporter - Basic reporter that outputs spec results to for the Teamcity build system.
- TerminalReporter - Logs to a terminal (including colors) with variable verbosity.
Should work with all modern versions of Phantom JS, and has been tested with PhantomJS 1.4.6 through 1.9.6 on Mac OS X. If you find issues with a particular version, please consider creating a pull request.
The reporters also work in Node.js, and most can be used in combination with jasmine-node. Make sure to use the correct combination of jasmine-reporters and jasmine-node, as both projects have different versions / branches for Jasmine1.x vs Jasmine2.x support.
When used for in-browser tests, the reporters are registered on a jasmineReporters
object in the
global scope (i.e. window.jasmineReporters
).
var junitReporter = new jasmineReporters.JUnitXmlReporter({
savePath: '..',
consolidateAll: false
});
jasmine.getEnv().addReporter(junitReporter);
In order to write files to the local filesystem for in-browser tests, the reporters will attempt
to use PhantomJS to create the files. A special method __phantom_writeFile
is injected by the
included phantomjs.runner.sh
script.
It is strongly recommended to use the provided script to run your test suite using PhantomJS. If
you want to use your own PhantomJS runner, you will need to inject a __phantom_writeFile
method, and also take care to correctly determine when all results have been reported.
You can use the included PhantomJS test runner to run any of the included examples.
NOTE: you will need to install the Jasmine dependency via bower
if you want to use the
included PhantomJS runner for any of the included examples--this is where the examples
look for the Jasmine core library.
# install jasmine via bower
bower install
# run any of the examples
bin/phantomjs.runner.sh examples/tap_reporter.html
bin/phantomjs.runner.sh examples/junit_xml_reporter.html