Add mocha test bundling with webpack and test running

This commit is contained in:
Tautvidas Sipavičius
2015-08-13 14:11:10 +03:00
parent e01316f9f3
commit 7a43980f32
5 changed files with 43 additions and 4 deletions

View File

@ -1,8 +1,10 @@
var path = require('path'),
fs = require('fs');
fs = require('fs'),
_ = require('underscore'),
baseConfig;
// webpack.config.js
module.exports = {
baseConfig = {
name: 'main',
context: __dirname ,
entry: {
admin: './assets/js/admin.js',
@ -46,3 +48,30 @@ module.exports = {
'jquery': 'jQuery',
}
};
module.exports = [
baseConfig,
// Configuration specific for testing
_.extend({}, baseConfig, {
name: 'test',
entry: {
testAjax: 'testAjax.js',
},
output: {
path: './tests/javascript/testBundles',
filename: '[name].js',
},
resolve: {
modulesDirectories: [
'node_modules',
'assets/js',
'tests/javascript/newsletter_editor'
],
fallback: path.join(__dirname, 'node_modules'),
alias: {
'handlebars': 'handlebars/runtime.js'
}
},
})
];