index.js
function Reporter (opts) {
  this.events = opts.events;
  this.config = opts.config;
  this.testCount = 0;
  this.testIdx = -1;
  this.variationCount = -1;
  this.data = {};
  this.data.tests = [];
  this.browser = null;

  var defaultReportFolder = 'report';
  this.dest = this.config.get('junit-reporter') && this.config.get('junit-reporter').dest ? this.config.get('junit-reporter').dest : defaultReportFolder;

  // prepare base xml
  this.xml = [
    {
      name: 'resource',
      attrs: {
        name:'DalekJSTest'
      },
      children: []
    }
  ];

  this.startListening();
}
function Reporter (opts) {
  this.events = opts.events;
  this.config = opts.config;
  this.testCount = 0;
  this.testIdx = -1;
  this.variationCount = -1;
  this.data = {};
  this.data.tests = [];
  this.browser = null;

  var defaultReportFolder = 'report';
  this.dest = this.config.get('junit-reporter') && this.config.get('junit-reporter').dest ? this.config.get('junit-reporter').dest : defaultReportFolder;

  // prepare base xml
  this.xml = [
    {
      name: 'resource',
      attrs: {
        name:'DalekJSTest'
      },
      children: []
    }
  ];

  this.startListening();
}
function Reporter ( opts ) { this . events = opts . events ; this . config = opts . config ; this . testCount = 0 ; this . testIdx = - 1 ; this . variationCount = - 1 ; this . data = { } ; this . data . tests = [ ] ; this . browser = null ; var defaultReportFolder = 'report' ; this . dest = this . config . get ( 'junit-reporter' ) && this . config . get ( 'junit-reporter' ) . dest ? this . config . get ( 'junit-reporter' ) . dest : defaultReportFolder ; // prepare base xml this . xml = [ { name : 'resource' , attrs : { name : 'DalekJSTest' } , children : [ ] } ] ; this . startListening ( ) ; }
The jUnit reporter can produce a jUnit compatible file with the results of your testrun,
this reporter enables you to use daleks testresults within a CI environment like Jenkins.

The reporter can be installed with the following command:

```bash
$ npm install dalek-reporter-junit --save-dev
```

The file will follow the jUnit XML format:

```html
<?xml version="1.0" encoding="utf-8"?>
<resource name="DalekJSTest">
<testsuite start="1375125067" name="Click - DalekJS guinea pig [Phantomjs]" end="1375125067" totalTests="1">
<testcase start="1375125067" name="Can click a select option (OK, jQuery style, no message)" end="1375125067" result="pass">
<variation start="1375125067" name="val" end="1375125067">
<severity>pass</severity>
<description>&lt;![CDATA[David is the favourite]]&gt;</description>
<resource>DalekJSTest</resource>
</variation>
<variation start="1375125067" name="val" end="1375125067">
<severity>pass</severity>
<description>&lt;![CDATA[Matt is now my favourite, bow ties are cool]]&gt;</description>
<resource>DalekJSTest</resource>
</variation>
</testcase>
</testsuite>
</resource>
```

By default the file will be written to `report/dalek.xml`,
you can change this by adding a config option to the your Dalekfile

```javascript
"junit-reporter": {
"dest": "your/folder/your_file.xml"
}
```

If you would like to use the reporter (in addition to the std. console reporter),
you can start dalek with a special command line argument

```bash
$ dalek your_test.js -r console,junit
```

or you can add it to your Dalekfile

```javascript
"reporter": ["console", "junit"]
```

@class Reporter
@constructor
@part JUnit
@api
The jUnit reporter can produce a jUnit compatible file with the results of your testrun this reporter enables you to use daleks testresults within a CI environment like Jenkins .