A reporter for Jasmine 2.0 that outputs JUnit XML to a file. Run it with PhantomJS.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example Reorganizing to explicitly separate files that are modified from Jasm… Mar 3, 2014
.gitignore Prevent errors from showing in devconsole when looking at specrunner … Jul 17, 2014
LICENSE.md Add license Mar 3, 2014
README.md Make clear phantom 2 is not supported Jul 31, 2015



By default, Jasmine 2.0 only provides a ConsoleReporter and HtmlReporter. Neither are suitable for reporting in a CI build. This project adds a JUnitXmlReporter which outputs JUnit compliant testreports. The reporter currently only works when running specs with PhantomJS 1.9.x.


In order to setup jasmine2-junit, you need to add the following scripts to your spec runner html file:

<!-- Include Jasmine 2.0's assets -->
<link href="lib/jasmine.css" rel="stylesheet" type="text/css">
<script src="lib/jasmine.js"></script>
<script src="lib/jasmine-html.js"></script>

<!-- The JUnit reporter should go before the boot script -->
<script src="../src/jasmine2-junit.js"></script>
<!-- This boot.js is a modified version of Jasmine's default boot.js! -->
<script src="../src/boot.js"></script>

<!-- Include your spec files here -->>
<script src="spec.js"></script>

Note that the boot.js file is a modified version of the file with same name that is provided by the default Jasmine 2.0 distribution. The only modification is that the JUnitXmlReporter is added as reporter. Currently, it seems impossible to add a reporter while still using the stock boot.js.

After you setup your spec html, you can use the jasmine2-runner.js script with PhantomJS to execute your spec:

phantomjs jasmine2-runner.js yourspec.html

After running this script, JUnit XML files with testresults are written to the current directory. They all start with a TEST- prefix and end with .xml.


See the example for a working setup of jasmine2-junit with Jasmine 2.0. Install the PhantomJS node package:

npm install -g phantomjs

(note: phantomjs2 is not supported!)

in the example directory, run phantomjs ../src/jasmine2-runner.js specrunner.html. JUnit XML output files are written with a TEST-* prefix for each top-level describe() (suite) in the testsuites that are run by specrunner.html.


The code and setup for this project are heavily based on the JUnitXmlReporter at https://github.com/larrymyers/jasmine-reporters which only worked for Jasmine 1.x at the time. Nowadays, this project has picked up steam again and supports Jasmine 2.x as well. I recommend looking there first, since it has a larger userbase and is actively maintained by multiple committers.