normful / mocha-junit-reporter

A JUnit XML reporter for mocha.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#JUnit Reporter for Mocha Build Status

Produces JUnit-style XML test results.

Installation

$ npm install mocha-junit-reporter --save-dev

or as a global module

$ npm install -g mocha-junit-reporter

Usage

Run mocha with mocha-junit-reporter:

$ mocha test --reporter mocha-junit-reporter

This will output a results file at ./test-results.xml. You may optionally declare an alternate location for results XML file by setting the environment variable MOCHA_FILE or specifying mochaFile in reporterOptions:

$ MOCHA_FILE=./path_to_your/file.xml mocha test --reporter mocha-junit-reporter

or

$ mocha test --reporter mocha-junit-reporter --reporter-options mochaFile=./path_to_your/file.xml

or

var mocha = new Mocha({
    reporter: 'mocha-junit-reporter',
    reporterOptions: {
        mochaFile: './path_to_your/file.xml'
    }
});

In order to display full suite title (including parents) just specify useFullSuiteTitle option

var mocha = new Mocha({
    reporter: 'mocha-junit-reporter',
    reporterOptions: {
        useFullSuiteTitle: true,
        suiteTitleSeparatedBy: '.' // suites separator, default is space (' ')
    }
});

About

A JUnit XML reporter for mocha.

License:MIT License


Languages

Language:JavaScript 100.0%