[英]Protractor Cucumber - 'Unhandled rejection Error: Cannot find module 'ts-node/register'
Step definitions files are not picking up while executing the below error message is displayed. 执行以下错误消息时,步骤定义文件未获取。
Unhandled rejection Error: Cannot find module 'ts-node/register'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /Users/Scope/node_modules/cucumber/src/cli/configuration_builder.js:137:7
at Array.forEach (native)
at ConfigurationBuilder.<anonymous> (/Users/Scope/node_modules/cucumber/src/cli/configuration_builder.js:134:27)
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/Scope/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/Scope/node_modules/bluebird/js/release/generators.js:97:49)
at ConfigurationBuilder.<anonymous> (/Users/Scope/node_modules/bluebird/js/release/generators.js:201:15)
at ConfigurationBuilder.expandSupportCodePaths (/Users/Scope/node_modules/cucumber/lib/cli/configuration_builder.js:225:22)
at ConfigurationBuilder.<anonymous> (/Users/Scope/node_modules/cucumber/src/cli/configuration_builder.js:36:37)
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/Scope/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/Scope/node_modules/bluebird/js/release/generators.js:97:49)
protractor.config.js file: protractor.config.js文件:
const path = require('path');
exports.config = {
directConnect: true,
baseUrl: 'https://www.google.com',
capabilities: {
browserName:'chrome'
},
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
// frameworkPath: require.resolve('serenity-js'),
specs: [
'./e2e/features/*.feature'
],
cucumberOpts: {
compiler: 'ts:ts-node/register',
require: [
"./e2e/features/step_definitions/*_step.ts",
// path.resolve(process.cwd(), './e2e/step_definitions/Test_step.ts')
],
tags: '@Test',
strict: false,
format: ["pretty", "json:report/json/cucumber_report.json"],
dryRun: false,
},
onPrepare: function () {
project: "./e2e/tsconfig.e2e.json";
browser.driver.manage().window().maximize();
}
};
I've tried the suggestion in stackoverflow but it didn't worked for me. 我已经尝试了stackoverflow中的建议,但对我没有用。
ts-node将需要安装,因为黄瓜require
要这样做。
npm install ts-node
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.