我有喜欢噶覆盖文件路径
项目
文件夹结构工程| --Web
| ----脚本
| ------应用
| - ------- feature.js
| ------利布斯
| ------测试
| --------规格
| ----- ----- spec.js
| -------- karma-conf.js
在我的karma-conf.js中,我将覆盖预处理器指向../App/feature.js,但是这给了我一个空白的覆盖率报告,指出'没有要显示的数据'。
我试过一些其他的路径配置没有运气。 Karma文档指出路径应该相对于基本路径。出于传统原因,我无法移动测试文件夹。
下面是我的人缘,conf.js
的重复我对任何见解非常感谢到路径如何为卡玛覆盖工作。
module.exports = function (config) {
config.set({
hostname: 'localhost',
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: ['jasmine'],
// list of files/patterns to load in the browser
files: [
{
pattern: '../App/feature.js',
watched: true,
served: true,
included: true
},
{
pattern: 'Specs/spec/*.js',
watched: true,
served: true,
included: true
}
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress','coverage'],
// web server port
port: 6789,
// enable/disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_DEBUG,
// enable/disable watching file and executing tests whenever any file changes
autoWatch: true,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
preprocessors: {
'**/.html': [],
'**/*.coffee': [],
"../App/feature.js": "coverage"
}
});
};
我也有一些问题路径的因果报应。 ..你尝试追加'base /'到路径。它在规格内对我有用 – Sergio