Skip to content

Instantly share code, notes, and snippets.

@KidkArolis
Last active October 10, 2015 21:00
Show Gist options
  • Save KidkArolis/0e9708210cc6f2a028e3 to your computer and use it in GitHub Desktop.
Save KidkArolis/0e9708210cc6f2a028e3 to your computer and use it in GitHub Desktop.
An example of karma with karma-webpack
var webpackConfig = require('./webpack.config')
module.exports = function (config) {
// prep your webpack config for karma
delete webpackConfig.entry
webpackConfig.devtool = 'cheap-inline-source-map'
config.set({
// standard karma things
basePath: '.',
frameworks: ['mocha', 'sinon'],
reporters: ['progress'],
autoWatch: true,
browsers: ['Chrome'],
logLevel: config.LOG_INFO,
// webpack
files: [
'testMain.js'
],
preprocessors: {
'testMain.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
webpackServer: {
noInfo: false,
progress: true
}
})
}
let testsContext = require.context('./tests', true, /Test$/)
testsContext.keys().forEach(testsContext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment