说我有以下代码:
define([
'a'
], function(a) {
return {
initialize: function() {
},
stuff: function() {
}
};
});
伊斯坦布尔报告称只有1/3的功能已经过测试。这有点真实,因为我只对main.initialize
进行了测试。
如何让Istanbul忽略用于定义回调的函数?
修改:其他Gruntfile.js
配置
jasmine: {
coverage: {
src: 'src/assets/js/app/**/*.js',
options: {
specs: 'src/assets/js/spec/**/*Spec.js',
host: 'http://127.0.0.1:8000/',
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
//files: 'src/assets/js/app/**/*.js',
coverage: 'bin/coverage/coverage.json',
report: [
{type: 'html', options: {dir: 'src/coverage/html'}},
{type: 'text-summary'}
],
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
baseUrl: 'src/assets/js',
paths: {
/* 'jquery': 'lib/jquery',
'underscore': 'lib/lodash',
'text': 'lib/text',
'i18n': 'lib/i18n',*/
}
}
}
},
keepRunner: true
}
}
}
编辑:示例规范
define([
'app/main'
], function(main) {
describe('app/main', function() {
it('initailize should not error', function() {
expect(main.initialize()).toBe(undefined);
});
});
});
答案 0 :(得分:2)