Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created July 22, 2015 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bulkan/0f459012034b28e4817b to your computer and use it in GitHub Desktop.
Save bulkan/0f459012034b28e4817b to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
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: [ 'mocha', 'chai' ], //use the mocha test framework
client: {
mocha: {
reporter: 'html', // change Karma's debug.html to the mocha web reporter
ui: 'bdd'
}
},
// list of files / patterns to load in the browser
files: [
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
'test-loader.js'
],
preprocessors: {
'test-loader.js': ['webpack', 'sourcemap']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec'],
// 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_ERROR,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
//browsers: ['Chrome', 'Firefox', 'PhantomJS'],
browsers: ['Chrome'],
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
webpack: {
devtool: 'eval',
resolve: {
modulesDirectories: ['.', 'node_modules', './src', './src/js'],
extensions: ['', '.js', '.jsx', '.csv']
},
plugins: [
new webpack.IgnorePlugin(/\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.woff2$|\.eot$|\.ttf$|\.wav$|\.ico$|.css$|.json$/),
new webpack.IgnorePlugin(/^\.\/lang$/, /moment$/),
new webpack.NormalModuleReplacementPlugin(/^sinon$/, __dirname + '/src/js/vendor/sinon-1.15.4.js'),
],
module: {
noParse: [
/sinon/
],
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components|vendor)/,
loader: 'babel',
query: {
optional: ['runtime', 'es7.classProperties', 'es7.decorators'],
cacheDirectory: true,
}
}
]
}
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment