Skip to content

Instantly share code, notes, and snippets.

@fweep
Created November 8, 2016 12:58
Show Gist options
  • Save fweep/edd7ada15f43d648feb8e1f16d899366 to your computer and use it in GitHub Desktop.
Save fweep/edd7ada15f43d648feb8e1f16d899366 to your computer and use it in GitHub Desktop.
Karma config
'use strict';
var path = require('path');
module.exports = function (config) {
config.set({
basePath: '../webpack/test',
reporters: ['mocha'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: false,
concurrency: Infinity,
frameworks: ['mocha', 'chai', 'sinon'],
browsers: ['PhantomJS'],
files: [
{
pattern: '**/*.test.js',
watched: true,
included: true,
served: true
},
],
preprocessors: {
'**/*.test.js': ['webpack']
},
webpack: {
resolve: {
root: path.join(__dirname, '..', 'webpack'),
extensions: ['', '.js', '.jsx'],
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: [/node_modules/],
query: {
presets: ['es2015', 'react']
}
},
]
},
// These externals are required to make Enzyme work.
// https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md
externals: {
'cheerio': 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': 'window',
},
},
webpackMiddleware: {
noInfo: true,
},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment