I'm trying to get the coverage report for my tests but the coverage output for all files is always on a single line showing the require with the path to the file. For example...
The tests however are running fine. This is a react project so I had to include some additional paths to the files and preprocessor to get the tests to run.
I'm not sure if there is something wrong with my karma config? This is what my config currently looks like...
/* global module */
module.exports = function (config) {
'use strict';
config.set({
autoWatch: true,
singleRun: true,
frameworks: ['browserify', 'jasmine'],
files: [
'node_modules/karma-babel-preprocessor/node_modules/babel-core/browser-polyfill.js',
'node_modules/react/react.js',
'src/**/*.jsx',
'src/**/!(*spec).js'
],
browsers: ['PhantomJS'],
preprocessors: {
'node_modules/react/react.js': ['browserify', 'sourcemap'],
'src/**/*.jsx': ['browserify', 'sourcemap', 'coverage'],
'src/**/!(*spec).js': ['browserify', 'sourcemap', 'coverage'],
},
browserify: {
debug: true,
transform: [ 'babelify' ]
},
reporters: ['progress', 'coverage'],
coverageReporter: {
instrumenters: {isparta: require('isparta')},
instrumenter: {
'src/**/*.js': 'isparta',
'src/**/*.jsx': 'isparta'
},
reporters: [
{
type: 'text-summary',
subdir: normalizationBrowserName
},
{
type: 'lcov',
subdir: normalizationBrowserName
},
{
type: 'html',
dir: 'coverage/',
subdir: normalizationBrowserName
}
]
}
});
function normalizationBrowserName(browser) {
return browser.toLowerCase().split(/[ /-]/)[0];
}
};
UPDATE: I used a commonjs transform as well and was able to get things to work a bit better but tests wouldn't run and the coverage was the transformed code.