I have been running jasmine unit-test and used Istanbul for code-coverage for long time but now I have come across a project which uses requirejs and I am unable to run Istanbul-Code-Coverage test for it.
The code successful gives runs jasmine test but node code-coverage is generated
jasmine: {
test: {
src: ['preview_export/scripts/loadPresentation.js', 'scripts/libs/**/*.js', 'components/codemirror/codemirror.js',
'bundles/**/*.js', 'scripts/common/collections/MultiMap.js',
'scripts/framework/ServiceRegistry.js'],
options: {
specs: ['jtest/spec/**/*.js'],
helpers: [
'node_modules/jasmine-ajax/lib/mock-ajax.js',
'app/scripts/mixpanel.js',
'app/scripts/constant.js', 'app/preview_export/download_assist/swfobject.js',
'app/scripts/common/util.js'],
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfigFile:'jasmine-require-config.js',
requireConfig: {
paths: {
'JST' : 'scripts/compiled-templates',
'framework' : 'scripts/framework'
}
}
}
}
},
coverage: {
src: ['preview_export/scripts/loadPresentation.js', 'scripts/libs/**/*.js', 'components/codemirror/codemirror.js',
'bundles/**/*.js', 'scripts/common/collections/MultiMap.js',
'scripts/framework/ServiceRegistry.js'],
options: {
specs: ['jtest/spec/**/*.js'],
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'bin/coverage/coverage.json',
},
report: [
{
type: 'html',
options: {
dir: 'bin/cover/html'
}
},
{
type: 'cobertura',
options: {
dir: '<%= meta.bin.coverage %>/cobertura'
}
},
{
type: 'text-summary'
}
]
}
}
}