This small tools aims to help you with a test results that were generated by mocha or similar test framework. Only requirement to utility is to generate XUnit XML reports and put them to "reports" folder.
This utility starts web server with port 2042 by default and allows you to get a list and stats of tests performed.
There are actually three basic ways to use this utility:
- install and use it globally
- install it as a dependency to your project and use launcher to run it
- install it as a dependency to your project and run it from your script
The easiest way to install this utility is just to run:
npm install -g xunit-reports-viewer
And then you can start reports viewer from your project root with:
xunit-viewer
If you want to let another team members to run this tool with your project, you can add a dependency to your project and then just run it from local folder:
npm install --save-dev xunit-reports-viewer
./node_modules/.bin/xunit-viewer
Also you can define this script in your package.json
:
{
...
"scripts": {
"xunit-viewer": "node_modules/.bin/xunit-viewer"
}
...
}
and then just run:
npm run xunit-viewer
This way may be useful if you want to use this tool with grunt, gulp, . You can add a dependency as in the previous example, but run it with your script like:
require('coffee-script').register();
require('node_modules/xunit-reports-viewer/server.coffee')({
dir: "<directory where your scripts are located>",
port: <your port here>
});
MIT