我的量角器工作正常,当更新它无法打开一个简单的spec文件,它总是给出错误.我搜索了一个解决方案,但无法找到一个conf和spec文件是量角器网站本身的样本我粘贴错误,希望你可以帮助.提前致谢
conf.js错误
[09:10:06] E/configParser - error code: 105
[09:10:06] E/configParser - description: failed loading configuration file spec.js
C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130
throw new exitCodes_1.ConfigError(logger, 'failed loading configurat
ion file ' + filename);
^
Error
at ConfigError.ProtractorError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:10:22)
at new ConfigError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:26:16)
at ConfigParser.addFileConfig (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130:19)
at Object.initFn [as init] (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\launcher.js:94:22)
at Object.<anonymous> (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\cli.js:130:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
Run Code Online (Sandbox Code Playgroud)
conf和spec文件是来自站点的示例文件
conf.js:
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
Run Code Online (Sandbox Code Playgroud)
spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
Run Code Online (Sandbox Code Playgroud)
Bar*_*jen 10
Per @jtzero的评论,问题在于配置解析器在加载配置文件时屏蔽实际的错误消息.
根据您是将Protractor作为全局运行还是从文件夹运行,请在第13行打开(C:\Users\y\AppData\Roaming\npm\)node_modules\protractor\built\configParser.js.在那里你可以添加logger.error(e);例如:
/**
* Public function specialized towards merging in a file's config
*
* @public
* @param {String} filename
*/
ConfigParser.prototype.addFileConfig = function (filename) {
if (!filename) {
return this;
}
var filePath = path.resolve(process.cwd(), filename);
var fileConfig;
try {
fileConfig = require(filePath).config;
}
catch (e) {
logger.error(e);
throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename);
}
if (!fileConfig) {
throw new exitCodes_1.ConfigError(logger, 'configuration file ' + filename + ' did not export a config object');
}
fileConfig.configDir = path.dirname(filePath);
this.addConfig_(fileConfig, fileConfig.configDir);
return this;
};
Run Code Online (Sandbox Code Playgroud)
然后,这将报告输出中的错误.在我的情况下,这是一个失败的电话require():
[10:36:29] E/configParser - { [Error: Cannot find module 'phantomjs'] code: 'MODULE_NOT_FOUND' }
Run Code Online (Sandbox Code Playgroud)
已回复的GitHub问题#3301:https://github.com/angular/protractor/issues/3301
更新
Protractor 4.0将包含此问题的修复程序,以报告带有堆栈跟踪的屏蔽错误消息.
| 归档时间: |
|
| 查看次数: |
25914 次 |
| 最近记录: |