forked from codecombat/codecombat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.karma.config.js
30 lines (28 loc) · 1 KB
/
webpack.karma.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Use this webpack config for Karma testing, with `webpack --config webpack.karma.config.js`
// This config is automatically selected depending on process.env in webpack.config.js
// process.traceDeprecation = true;
const webpack = require('webpack');
const _ = require('lodash');
const baseConfigFn = require('./webpack.base.config')
// Development webpack config
module.exports = (env) => {
if (!env) env = {};
const baseConfig = baseConfigFn(env);
return _.merge(_.assign(baseConfig, {
// Only use this one entry point for karma testing
entry: {
test: './app/assets/javascripts/run-tests.js'
}
}), {
output: _.merge({}, baseConfig.output, {
chunkFilename: 'javascripts/chunks/[name].bundle.js',
}),
plugins: [
new webpack.DefinePlugin({
DEF_CHINA_INFRA: process.env.COCO_CHINA_INFRASTRUCTURE ? 'true' : 'false',
})
]
// TODO: Get sourcemaps working with Karma
// devtool: 'source-map', // https://webpack.js.org/configuration/devtool/
})
}