我使用本指南http://karma-runner.github.io/0.8/config/coverage.html来设置我的 Karma-coverage 插件。此外,它通过 package.json 文件在本地安装,如下所示:
{
"name": "myApp",
"version": "0.1.0",
"devDependencies": {
"karma-jasmine": "latest",
"karma-coverage": "latest",
"karma-coffee-preprocessor": "latest",
"karma-chrome-launcher": "latest",
"coffee-script": "latest"
}
}
Run Code Online (Sandbox Code Playgroud)
我的 Karma.conf 如下所示:
// Karma configuration
// Generated on Sun Dec 07 2014 15:51:07 GMT+0100 (CET)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to …Run Code Online (Sandbox Code Playgroud)