Skip to content

Instantly share code, notes, and snippets.

@Swiip
Created October 19, 2016 09:46
Show Gist options
  • Save Swiip/eda19dda3664a7e40f01c862be601c21 to your computer and use it in GitHub Desktop.
Save Swiip/eda19dda3664a7e40f01c862be601c21 to your computer and use it in GitHub Desktop.
"Testing an AngularJS app with Jest" karma code sample
module.exports = function (config) {
config.set({
basePath: '../',
singleRun: true,
autoWatch: false,
files: [
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'src/app/mock/utils.js',
'src/index.spec.js'
],
frameworks: ['jasmine'],
preprocessors: {
'src/index.spec.js': ['webpack']
},
browsers: ['Chrome'],
reporters: ['progress', 'coverage'],
webpack: require('./webpack-test-coverage.conf'),
webpackMiddleware: { noInfo: true },
junitReporter: { outputDir: 'test-reports' },
coverageReporter: {
reporters: [
{type: 'cobertura', dir:'test-coverage/', subdir:'.'},
{type: 'lcov', dir:'test-coverage/', subdir:'.'}
]
},
plugins: [
require('karma-jasmine'),
require('karma-junit-reporter'),
require('karma-coverage'),
require('karma-chrome-launcher'),
require('karma-webpack')
]
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment