-
Notifications
You must be signed in to change notification settings - Fork 4
/
karma.conf.js
53 lines (49 loc) · 1.31 KB
/
karma.conf.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
import { argv } from 'yargs';
import webpackConfig from './webpack.config';
import config from './jsconfig/config';
const debug = require('debug')('app:karma');
debug('Create configuration.');
const karmaConfig = {
basePath: './', // project root in relation to bin/karma.js
files: [
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
{
pattern: `${config.dir_test}**/*.js`,
watched: false,
served: true,
included: true
}
],
singleRun: !argv.watch,
frameworks: ['mocha', 'chai-sinon', 'chai-as-promised', 'chai'],
preprocessors: {
[`${config.dir_test}**/*.js`]: ['webpack']
},
reporters: ['spec'],
browsers: ['PhantomJS'],
webpack: {
devtool: 'inline-source-map',
resolve: webpackConfig.resolve,
plugins: webpackConfig.plugins
.filter(plugin => !plugin.__KARMA_IGNORE__),
module: {
loaders: webpackConfig.module.loaders
},
sassLoader: webpackConfig.sassLoader
},
webpackMiddleware: {
noInfo: true
},
coverageReporter: {
reporters: config.coverage_reporters
}
};
if (config.coverage_enabled) {
karmaConfig.reporters.push('coverage');
karmaConfig.webpack.module.preLoaders = [{
test: /\.(js|jsx)$/,
include: new RegExp(config.dir_client),
loader: 'isparta'
}];
}
export default (cfg) => cfg.set(karmaConfig);