Skip to content

FlorianRappl/nightwatch-nunit3-reporter

Repository files navigation

nightwatch-nunit3-reporter

Build Status npm Version GitHub Tag GitHub Issues

This is a custom reporter for Nightwatch.js that generated NUnit 3 compatible XML files. This is particularly useful to support, e.g., Azure DevOps, which cannot handle attachments in the JUnit reports generated out of the box by Nightwatch.js.

Getting Started

You need to have Node with NPM installed. In your repository run

npm i nightwatch-nunit3-reporter

This install the reporter. Besides Node.js and everything that comes with it you need to have Nightwatch installed.

The configuration of the package in Nightwatch is fairly simple. You can either use the package via the command line overriding the standard JUnit reporter:

nightwatch --reporter node_modules/nightwatch-nunit3-reporter/index.js

Or you can use it via your globals.js file in addition to the JUnit reporter:

import { createReporter } from 'nightwatch-nunit3-reporter';

const reporter = createReporter({
  output_folder: './reports', // should be different to the JUnit folder
});

module.exports = {
  // ...
  reporter,
};

This way you need to set up the output folder. In the CLI case the output folder is determined by Nightwatch.js.

Alternatively, if you start Nightwatch from the root directory where your nightwatch.json is located you can use:

import { reporter } from 'nightwatch-nunit3-reporter';

module.exports = {
  // ...
  reporter,
};

This one uses the output_folder from the nightwatch.json. In this case a subfolder called nunit3 will be created at the location specified by output_folder.

License

nightwatch-nunit3-reporter is released using the MIT license. For more information see the LICENSE file.