有人请让我知道我的conf.js文件中的错误是什么。我添加了我的conf.js文件并显示错误。当我评论JasmineNodeOpts时,conf.js可以正常工作。但是,我需要默认计时器。
exports.config = {
directConnect: true,
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['CreateProject_spec.js'],
capabilities: {
browserName: 'chrome' ,
}
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000,
}
};
C:\Users\Sumana\AppData\Roaming\npm\node_modules\protractor\example>protractor conf.js
[11:46:29] E/configParser - Error code: 105
[11:46:29] E/configParser - Error message: failed loading configuration file conf.js
[11:46:29] E/configParser - C:\Users\Sumana\AppData\Roaming\npm\node_modules\protractor\example\conf.js:19
jasmineNodeOpts: {
^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at ConfigParser.addFileConfig (C:\Users\Sumana\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:135:26)
在capabilities
背后丢失了一个逗号。有许多语法高亮显示器,例如在Visual Studio代码中检测到此类错误。
这应该可以解决您的错误:
exports.config = {
directConnect: true,
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['CreateProject_spec.js'],
capabilities: {
browserName: 'chrome' ,
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000,
}
};