cucumber-html-reporter icon indicating copy to clipboard operation
cucumber-html-reporter copied to clipboard

Can't generate report from cucumber json files.

Open llwch opened this issue 5 years ago • 1 comments

Hello everyone. Thanks for the cool reporter.

But on my new project, I need a framework with cypress + ts + cucumber. With colorful reports. And have some problem with generating reports.

I use cypress-cucumber-preprocessor with settings to receive reports in json:

"cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true, "cucumberJson": { "generate": true, "outputFolder": "cypress/cucumber-json", "filePrefix": "", "fileSuffix": ".cucumber" } }

As the result, I have 2 json files: download

Aslo cucumber-html-reporter.js to generate html:

const {generate} = require('cucumber-html-reporter');

const options = { theme: 'hierarchy', jsonDir: '/cypress/cucumber-json', output: '/cypress/reports/report.html', reportSuiteAsScenarios: true, scenarioTimestamp: true, launchReport: true, ignoreBadJsonFile: true, metadata: { "App Version": "1.0.0", "Test Environment": "STAGING", "Browser": "Chrome 54.0.2840.98", "Platform": "Windows 10", "Parallel": "Scenarios", "Executed": "Remote" } };

generate(options);

But when I use script to generate html report - receive error: ` node cucumber-html-reporter.js

D:\ocean.e2e\node_modules\cucumber-html-reporter\lib\jsonDir.js:13
throw new Error(''options.jsonDir' does not exist. ' + e); ^

Error: 'options.jsonDir' does not exist. Error: /cypress/cucumber-json does not exist. at Object.collectJSONS (D:\ocean.e2e\node_modules\cucumber-html-reporter\lib\jsonDir.js:13:15) at Object.generate (D:\ocean.e2e\node_modules\cucumber-html-reporter\lib\reporter.js:492:17) at generateReport (D:\ocean.e2e\node_modules\cucumber-html-reporter\index.js:30:21) at Object. (D:\ocean.e2e\cucumber-html-reporter.js:21:1) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47`

Have I missed something? Don't understand what's wrong. Files can be found inside fileSync method.

llwch avatar Sep 21 '20 13:09 llwch

@llwch Make sure the folder /cypress/reports/ exists; else, it's not generating html reports.

prashanth-sams avatar Nov 18 '20 11:11 prashanth-sams