I'm trying to use karma-jamine for unit testing an Angular project which leverages browserify. However is seems, the karma.config either runs the tests or generates the coverage report using karma-istanbul. In the scenario that the tests run (karma.config.js as below) the coverage report shows 100% no matter what. If I include istanbul (commented in the code below) it shows bundle error and test don't run, the report therefore shows 0% for all tests. Please could you help.
Hi
I'm trying to use karma-jamine for unit testing an Angular project which leverages browserify. However is seems, the karma.config either runs the tests or generates the coverage report using karma-istanbul. In the scenario that the tests run (karma.config.js as below) the coverage report shows 100% no matter what. If I include istanbul (commented in the code below) it shows bundle error and test don't run, the report therefore shows 0% for all tests. Please could you help.
`
// Karma configuration
'use strict';
var istanbul = require('browserify-istanbul');
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','browserify'],
// list of files / patterns to load in the browser
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js', // for angular.mock.module and inject.
'app/**/*.js'
],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'app/**/*.js':['browserify','coverage'],
'app/*.spec.js':['browserify']
},
// karma-browserify configuration
browserify: {
debug: true,
transform: ['debowerify','partialify', istanbul({
'ignore': ['./**/*.spec.js', './bower_components/**']
})],
//transform: ['debowerify','partialify'],
// don't forget to register the extensions
extensions: ['.js']
},
// test results reporter to use
// possible values: 'dots', 'progress', 'spec'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],
coverageReporter: {
//type: 'text',
//dir: './reports/coverage'
reporters: [
{ type: 'html', dir: 'reports/coverage'}
// { type: 'text' },
],
instrumenterOptions: {
istanbul: {
noCompact: true
}
},
instrumenter: {
'app/*.spec.js': 'istanbul'
},
includeAllSources: true
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
'Chrome'
// 'PhantomJS'
],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
Hi
I'm trying to use karma-jamine for unit testing an Angular project which leverages browserify. However is seems, the karma.config either runs the tests or generates the coverage report using karma-istanbul. In the scenario that the tests run (karma.config.js as below) the coverage report shows 100% no matter what. If I include istanbul (commented in the code below) it shows bundle error and test don't run, the report therefore shows 0% for all tests. Please could you help. Hi
I'm trying to use karma-jamine for unit testing an Angular project which leverages browserify. However is seems, the karma.config either runs the tests or generates the coverage report using karma-istanbul. In the scenario that the tests run (karma.config.js as below) the coverage report shows 100% no matter what. If I include istanbul (commented in the code below) it shows bundle error and test don't run, the report therefore shows 0% for all tests. Please could you help.
` // Karma configuration
'use strict';
var istanbul = require('browserify-istanbul'); module.exports = function (config) {
}; `