elcharrua
elcharrua

Reputation: 1682

Nightwatch cucumber generate static html report

I'm trying to generate a report on nightwatch cucumber using nightwatch-html-reporter but I'm not able to make it work.

The library I am using is [Nightwatch html Reporter][1], I followed the steps described but I'm getting the error when reading the reports directory:

Reading reports directory...
events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'name' of undefined

Upvotes: 0

Views: 811

Answers (1)

Lucas Carnevalli
Lucas Carnevalli

Reputation: 62

The correct configuration would be:

Create file in root tests, same level of package.json.

var reporter = require('cucumber-html-reporter');

var options = {
    theme: 'bootstrap',
    jsonFile: 'reports/cucumber.json',
    output: 'reports/index.html',
    reportSuiteAsScenarios: true,
    launchReport: false
};

reporter.generate(options);

And configure runner in package.json. Example:

"scripts": {
    "e2e": "npm-run-all test report --continue-on-error",
    "test": "nightwatch",
    "report": "node create-html-report.js"
}

Make sure it is set up this way, or enter more details of the error.

Upvotes: 1

Related Questions