forked from fecgov/fec-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
91 lines (73 loc) · 2 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
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
/* global process */
const istanbul = require('browserify-istanbul');
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function(config) {
const browserify = {
debug: true,
transform: ['hbsfy', ['babelify', { presets: ['es2015'] }]]
};
let reporters = ['progress', 'coverage-istanbul'];
if (process.argv.indexOf('--debug') === -1) {
browserify.transform.push(
istanbul({
ignore: ['**/tests/**/*.js', '**/*.hbs']
})
);
reporters.push('coverage');
}
config.set({
frameworks: ['browserify', 'mocha', 'chai-sinon'],
files: [
'node_modules/babel-polyfill/dist/polyfill.js',
'fec/fec/tests/js/**/*.js'
],
exclude: ['**/hallo-edit-html.js', 'fec/fec/static/js/init.js'],
preprocessors: {
'fec/fec/tests/js/*.js': ['browserify'],
'fec/fec/tests/js/draftail/**/*.js': ['webpack']
},
browserify: browserify,
coverageReporter: {
subdir: '.',
reporters: [
//uncomenting to generate coverage/index.html, but this will result in Instanbul error: Cannot read property 'text' of undefined
//{ type: 'html'},
{ type: 'text' },
{ type: 'json', file: 'coverage.json' }
]
},
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['latest', 'react']
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'istanbul-instrumenter-loader',
query: {
esModules: true
}
}
]
}
},
reporters: reporters,
coverageIstanbulReporter: {
reports: ['text-summary'],
fixWebpackSourcePaths: true
},
browsers: ['ChromeHeadless'],
port: 9876,
autoWatch: false,
colors: true,
logLevel: config.LOG_INFO
});
};