E / configParser - 错误消息:配置文件cli.js未导出配置对象

时间:2018-06-14 05:37:27

标签: angularjs node.js eclipse npm protractor

我是量角器的新手,我在eclipse中成功设置了量角器。我遵循这个https://www.protractortest.org/#/链接,其中conf.js包含:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js']
};

和spec.js包含:

describe('angularjs homepage todo list', function() {
  it('should add a todo', function() {
    browser.get('https://angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
  });
});

链接上提到的代码。但是当我执行conf.js时,它会在eclipse的控制台中向我显示错误。

[10:31:25] E/configParser - Error code: 105

[10:31:25] E/configParser - Error message: configuration file D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\cli.js did not export a config object

[10:31:25] E/configParser - Error: configuration file D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\cli.js did not export a config object   

at ConfigParser.addFileConfig (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\configParser.js:141:19)
at Object.initFn [as init] (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\launcher.js:93:22)
at Object.<anonymous> (D:\Selenium_Workspace\ProtractorJavaScriptProject5\node_modules\protractor\built\cli.js:225:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)

请建议。

1 个答案:

答案 0 :(得分:0)

以下是我在日食中运行的运行配置。

1)主标签 test是我的项目文件夹

enter image description here

2)量角器选项卡 enter image description here

我安装Angularjs Eclipse 1.2无法让我选择自己安装的Nodejs,我必须在Angularjs Eclipse 1.2中使用嵌入式Nodejs,但这个版本较低版本无法满足我的要求量角器,因此我将我的高版本node.exe复制到embed Nodejs安装文件夹中以覆盖较低的node.exe。在那之后,所有事情都按预期工作了

有些Google搜索说Angularjs Eclipse 1.3可以修复can't choose self installed Nodejs,但我没有运气将它安装在Eclipse java Luna和Eclipse jee Luna上。