gkushang / cucumber-html-reporter

Generates Cucumber HTML reports in three different themes
MIT License
234 stars 155 forks source link

Problem when generate html report with date #161

Open alaa069 opened 5 years ago

alaa069 commented 5 years ago
const reporter = require('cucumber-html-reporter');
const moment = require('moment');
const package = require('./package.json');

let date = moment().toISOString();

let options = {
    theme: `bootstrap`,
    jsonFile: `reports/report.json`,
    output: `reports/report_${package.version}_${date}.html`,
    reportSuiteAsScenarios: true,
    launchReport: false,
    metadata: {
        "App Version": package.version,
        "Test Environment": "STAGING",
        "Browser": "Chrome  54.0.2840.98",
        "Platform": "Windows 10",
        "Parallel": "Scenarios",
        "Executed": "Remote"
    }
};

reporter.generate(options);

I get this output problem in console :

Error: ENOENT: no such file or directory, open 'reports\report_1.0.0_2018-10-26T09:32:35.408Z.html'
    at Object.generate (c:\Users\alaa069\Documents\tests\node_modules\cucumber-html-reporter\lib\reporter.js:471:9)
    at Object.generateReport [as generate] (c:\Users\alaa069\Documents\tests\node_modules\cucumber-html-reporter\index.js:30:21)
    at Object.<anonymous> (c:\Users\alaa069\Documents\tests\index.js:24:10)
    at Module._compile (module.js:650:14)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
larryg01 commented 5 years ago

your "jsonFile" has to have the same name as your "output" file

i.e. JsonFile: reports/report_${package.version}_${date}.json, output: reports/report_${package.version}_${date}.html,