-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallaby.config.js
120 lines (88 loc) · 2.99 KB
/
wallaby.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
var path = require('path')
var webpack = require('webpack')
var wallabyWebpack = require('wallaby-webpack');
var devConfig = require('./webpack/webpack.config.js')({})
var paths = require('./webpack/paths')
var emptyModule = path.resolve('vendor', 'empty-module.js')
module.exports = function (wallaby) {
/** Webpack overrides */
devConfig.devtool = 'eval'
var src = path.join(wallaby.projectCacheDir, 'src')
devConfig.resolve.modules.concat([])
/** GLOBAL */
devConfig.resolve.alias.test = paths.test.unit
/** APPS */
devConfig.resolve.alias.src = src
devConfig.entryPatterns = [
'src/app.js',
'test/fixture.js',
'src/**/*-test.js'
];
// Ignore scss
//devConfig.plugins.push(new webpack.IgnorePlugin(/\.scss$/));
devConfig.plugins.push(new webpack.NormalModuleReplacementPlugin(/\.(gif|png|scss|css)$/, emptyModule))
devConfig.plugins.push(new webpack.NormalModuleReplacementPlugin(/^bootstrap-loader$/, emptyModule))
//devConfig.plugins.push(new webpack.ProvidePlugin({
// __TESTING__: true,
// __DEV__ : false,
// __PROD__ : false,
//}))
// Delete babel-loader and sass-loader
devConfig.module.loaders = devConfig.module.loaders.filter(function(l){
return (l['loader'] !== 'babel-loader'
|| l['name'] !== 'sass-loader')
});
var wallabyPostprocessor = wallabyWebpack(devConfig);
var babelCompiler = wallaby.compilers.babel({
babel: require('babel-core'),
babelrc: false,
extends: path.resolve('./config/babel.dev.js'),
})
return {
debug: false,
files: [
/** PLUGINS */
{pattern: 'node_modules/babel-polyfill/polyfill.js', instrument: false},
/** CORE MODULES */
{pattern: 'src/**/*.js', load: false},
/** FIXTURES */
{pattern: 'test/fixture.js', load: false},
/** VENDOR */
//{pattern: 'node_modules/d3/d3.min.js', instrument: false},
/** POLYFILLS */
{pattern: 'node_modules/karma-phantomjs-shim/shim.js', instrument: false},
/** TESTING */
{pattern: '../node_modules/chai/chai.js', instrument: false},
{pattern: 'node_modules/sinon/pkg/sinon.js', instrument: false}, // http://sinonjs.org/
//{pattern: '../node_modules/sinon-chai/lib/sinon-chai.js', instrument: false}, // http://chaijs.com/plugins/sinon-chai
//{pattern: '../node_modules/chai-as-promised/lib/chai-as-promised.js', instrument: false},
/** IGNORE */
/** IGNORE - Tests */
{pattern: 'src/**/*-test.js', ignore: true},
],
tests: [
{pattern: 'src/**/*-test.js', load: false}
],
testFramework: '[email protected]',
//env: {
// runner: require('phantomjs2-ext').path,
// params: { runner: '--web-security=false' }
//},
compilers: {
'src/**/*.js': babelCompiler,
},
postprocessor: wallabyPostprocessor,
middleware: (app, express) => {
app.use('/node_modules',
express.static(path.join(__dirname, 'node_modules'))
)
},
bootstrap: function () {
var mocha = wallaby.testFramework;
mocha.ui('bdd');
window.HTTP_HOST = 'http://'
window.HOSTNAME = 'localhost:3000/'
window.__moduleBundler.loadTests();
}
}
};