1
votes

While using cucumber-html-reporter to generate a report in case of sharding with muliple chrome instances, I am getting "Error: Invalid Cucumber JSON file found" Below is my configuration,

var reporter = require('cucumber-html-reporter');
var options = {
    theme: 'bootstrap',
    reportSuiteAsScenarios: true,
    brandTitle: 'E2E Report',
    name:  _env.toUpperCase(),
    metadata: {
        "Test Environment": _env,
        "Browser": 'Chrome',
        "Platform": process.platform,
        "Parallel": "Scenarios",
        "Executed": "Remote"
    }
};

Error: [16:57:23] E/launcher - Error: Error: Invalid Cucumber JSON file found under ./e2e-reports/rest-api: e2e-reports/rest-api/results.25181.json

This happens when I try to use tag filters while running the suite. Due to which one of the feature file shows 0 scenarios have run. And as I have enabled sharding the result json specific to that chrome process shows empty. Is there any way to handle this?

1

1 Answers

0
votes

You can set ignoreBadJsonFile as true in your cucumber-html-reporter options. This will ignore the bad json files and generates the report.

In your case, add as below:

var reporter = require('cucumber-html-reporter');
var options = {
    theme: 'bootstrap',
    reportSuiteAsScenarios: true,
    ignoreBadJsonFile: true,
    brandTitle: 'E2E Report',
    name:  _env.toUpperCase(),
    metadata: {
        "Test Environment": _env,
        "Browser": 'Chrome',
        "Platform": process.platform,
        "Parallel": "Scenarios",
        "Executed": "Remote"
    }
};