title: Generate Cucumber report after test execution with Nightwatch-Cucumber
body: <p>Until <code>Nightwatch-Cucumber@7.3.1</code> the framework used <code>Cucumber 2</code> and I realized my Cucumber report generation in a hook with an <code>Event Handler</code> directly after test execution, like:</p>
  
  <pre><code>const reporter = require("cucumber-html-reporter");
  
  defineSupportCode(function({ registerHandler }) {
    registerHandler("AfterFeature", function(features, callback) {
      try {
        var options = {
          theme: "bootstrap",
          jsonFile: "./reports/json_result/cucumber.json",
          output: "./reports/json_result/cucumber_report.html",
          reportSuiteAsScenarios: true,
          launchReport: false,
          metadata: {
            "App Version": "0.0.3"
         }
       };
       reporter.generate(options);
      } catch (e) {
        console.log(
          "Report generation is not possible with the following message:"
        );
        console.log(e);
      }
  
      client.end();
      callback();
    });
  });
  </code></pre>
  
  <p>But since <code>Nightwatch-Cucumber@8.0.0</code> the framework uses <code>Cucumber 3</code> and the <code>Event Handler</code> isn't available anymore. Now I want to use <code>AfterAll</code> function of <code>Cucumber.js</code>, but the content of cucumber json report isn't generated at the time of executing the <code>AfterAll</code> function. So I get exception <code>reports/json_result/cucumber.json: Unexpected end of JSON input</code>, because the cucumber json file is empty at this time. How can I generate a Cucumber report after test execution in something like a <code>AfterAll</code> for a tear down. </p>
  
  <p>Here is my current code:</p>
  
  <pre><code>const reporter = require("cucumber-html-reporter");
  
  defineSupportCode(function({ AfterAll }) {
    AfterAll(function(callback) {
      try {
        var options = {
          theme: "bootstrap",
          jsonFile: "./reports/json_result/cucumber.json",
          output: "./reports/json_result/cucumber_report.html",
          reportSuiteAsScenarios: true,
          launchReport: false,
          metadata: {
            "App Version": "0.0.3"
         }
       };
       reporter.generate(options);
      } catch (e) {
        console.log(
          "Report generation is not possible with the following message:"
        );
        console.log(e);
      }
  
      client.end();
      callback();
    });
  });
  </code></pre>