我有量角器和黄瓜作为全局依赖项,我设置了NODE_PATH环境变量,根据我的要求,我需要创建自定义插件,并在我的项目结构中对量角器中的cucumber.js进行一些更改。我在运行new framework.js
时遇到错误错误:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
C:\*****\*****\AppData\Roaming\npm\cucumber.js:2
basedir=`dirname "$0"`
^
[launcher] Error: SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.exports.run (D:\**********\*****\protractor\cucumber.js:13:18)
at C:\*****\*****\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:326:35
at _fulfilled (C:\*****\*****\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\*****\*****\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30
[launcher] Process exited with error code 100
我的自定义插件代码是
var ConfigParser = require(process.argv[1]+'/../../lib/configParser'),
q = require('q');
/**
* Execute the Runner's test cases through Cucumber.
*
* @param {Runner} runner The current Protractor Runner.
* @param {Array} specs Array of Directory Path Strings.
* @return {q.Promise} Promise resolved with the test results
*/
exports.run = function(runner, specs) {
// TODO - add the event interface for cucumber.
var Cucumber = require('cucumber'), <-- getting error here
execOptions = ['node', 'node_modules/.bin/cucumber-js'],
cucumberResolvedRequire;
etc...
请让我知道我在哪里做错了..
感谢。