Skip to content

Instantly share code, notes, and snippets.

@zmbush
Created April 26, 2016 23:39
Show Gist options
  • Save zmbush/ca028b27f99f87d77021685face50be5 to your computer and use it in GitHub Desktop.
Save zmbush/ca028b27f99f87d77021685face50be5 to your computer and use it in GitHub Desktop.
webpackConfig = require('./webpack.config.js');
// Delete some stuff that confuses karma
webpackConfig.devtool = 'inline-source-map';
delete webpackConfig.entry;
delete webpackConfig.output;
delete webpackConfig.context;
delete webpackConfig.plugins;
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'tests.webpack.js',
],
coverageReporter: {
dir: '.testing-outputs',
reporters: [
{ type: 'cobertura', subdir: '.', file: 'cobertura.xml' },
{ type: 'text-summary' }
]
},
junitReporter: {
outputDir: '.testing-outputs',
outputFile: 'javascript-test-results.xml',
useBrowserName: false,
suite: 'fe',
},
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap'],
},
reporters: ['spec', 'coverage'],
webpack: Object.assign({}, webpackConfig, {
module: Object.assign({}, webpackConfig.module, {
preLoaders: [
{
test: /\.jsx?$/,
exclude: /(test|node_modules|bower_components)/,
loader: 'isparta'
}
]
})
}),
webpackMiddleware: {
noInfo: true
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: true,
concurrency: Infinity,
plugins: [
'karma-chrome-launcher',
'karma-coverage',
'karma-mocha',
'karma-phantomjs-launcher',
'karma-sourcemap-loader',
'karma-spec-reporter',
'karma-junit-reporter',
'karma-webpack',
]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment