我正在升级CucumberJS版本(从1.3.3到5.1.0),现在的问题是,用于在index.js中以编程方式调用Culim Cli的代码不再起作用。 />
node ./index.js -s ./step_definitions
index.js文件:
cucumberCli.run(function(succeeded) {
var code = succeeded ? 0 : 1;
function exitNow() {
process.exit(code);
}
if (process.stdout.write("")) {
exitNow();
} else {
// write() returned false, kernel buffer is not empty yet...
process.stdout.on("drain", exitNow);
}
});
我遇到错误了
cucumberCli = cucumber.Cli(process.argv);
^
TypeError: Class constructor Cli cannot be invoked without 'new'
at Object.<anonymous> (E:\newFrame - Copy\index.js:182:24)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! newframe@1.0.0 test: `node ./index.js -s ./step_definitions -x 50000`
npm ERR! Exit status 1
我尝试使用新关键字以及所有可能的方法来克服此问题,但是没有运气。