我发现了这个非常棒的 ember 测试样本:
https://github.com/toranb/ember-testing-example
让它运行,但我无法让业力覆盖工作,这是错误:
错误 [coverage]:[TypeError:无法设置未定义的属性“覆盖”] TypeError:无法设置未定义的属性“覆盖”
我只更新了 karma.conf.js 文件以及 package.json
包.json
{
"dependencies": {
"bower": "*",
"karma-ember-preprocessor": "*",
"karma-qunit": "*",
"karma": "0.10",
"karma-coverage": "~0.1"
},
"scripts": {
"postinstall": "bower install"
}
}
业力.conf.js
module.exports = function(karma) {
karma.set({
basePath: 'js',
files: [
"vendor/jquery/jquery.min.js",
"vendor/handlebars/handlebars.js",
"vendor/ember/ember.js",
"vendor/jquery-mockjax/jquery.mockjax.js",
"app.js",
"tests/*.js",
"templates/*.handlebars"
],
// coverage reporter generates the coverage
reporters: ['progress', 'coverage'],
//logLevel: karma.LOG_ERROR,
logLevel: karma.LOG_DEBUG,
browsers: ['PhantomJS'],
singleRun: true,
autoWatch: true,
frameworks: ["qunit"],
plugins: [
'karma-qunit',
'karma-coverage',
'karma-chrome-launcher',
'karma-ember-preprocessor',
'karma-phantomjs-launcher'
],
preprocessors: {
"**/*.handlebars": ['ember','coverage']
},
// optionally, configure the reporter
coverageReporter: {
type : 'html',
dir : 'coverage/'
}
});
};
请让我知道我错过了什么。我怀疑我没有正确配置它,这条线可能是问题所在。
preprocessors: {
"**/*.handlebars": ['ember','coverage']
},
任何帮助将不胜感激。