Encountering an error mentioned in the title while using the code snippet below:
import * as fs from 'fs'
import { mkdirp } from 'mkdirp'
import * as report from 'cucumber-html-reporter'
const Cucumber = require('cucumber')
export class CucumberReportExtension {
private static jsonDir = __dirname + '/../../test/reports/json';
private static htmlDir = __dirname + '/../../test/reports/html';
private static jsonFile = CucumberReportExtension.jsonDir + '/cucumber_report.json';
private static cucumberReporterOptions = {
theme: 'bootstrap',
jsonFile: CucumberReportExtension.jsonFile,
output: CucumberReportExtension.htmlDir + '/cucumber_reporter.html',
reportSuiteAsScenarios: true,
launchReport: true,
metadata: {
'App Version':'1.0.0',
'Test Environment': 'Development',
Browser: 'Chrome 84.0.4147.105',
Platform: 'Windows 10',
Parallel: 'Scenarios',
Executed: 'Local'
}
}
public static CreateReportFile(dirName) {
// Check of the directory exist
if (!fs.existsSync(dirName))
mkdirp.sync(dirName);
}
public static GenerateCucumberReport(){
report.generate(CucumberReportExtension.cucumberReporterOptions);
}
}
The dependencies listed in my package.json are as follows:
"dependencies": {
"@types/jasmine": "^3.5.11",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^14.0.14",
"faker": "^5.1.0",
"jasmine": "^3.5.0",
"lodash": "^4.17.20",
"log4js": "^6.3.0",
"log4js-protractor-appender": "^1.1.2",
"mkdirp": "latest",
"moment": "^2.28.0",
"pg": "^8.3.3",
"pg-hstore": "^2.3.3",
"protractor": "^7.0.0",
"qs": "^6.9.4",
"stringinject": "^2.1.1"
},
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@types/chai": "^4.2.11",
"@types/cucumber": "^6.0.1",
"@types/load-json-file": "^5.1.0",
"axios": "^0.19.2",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-smoothie": "^0.3.2",
"core-js": "^3.6.5",
"cucumber": "^6.0.5",
"cucumber-html-reporter": "^5.2.0",
"https": "^1.0.0",
"k6": "0.0.0",
"load-json-file": "^6.2.0",
"multiple-cucumber-html-reporter": "^1.16.3",
"nodejs-nodemailer-outlook": "^1.2.3",
"protractor-cucumber-framework": "^6.2.1",
"request": "^2.88.2",
"ts-node": "^8.10.2",
"tslint": "^6.1.3",
"tslint-etc": "^1.13.6",
"typescript": "^3.9.7",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
}
}