-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.config.js
98 lines (95 loc) · 2.44 KB
/
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
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
var path = require('path');
var argv = require('yargs').argv;
process.env.BABEL_ENV = 'karma';
const coverage_reporters = [
{ type: 'text-summary' },
];
const reporters = [
'mocha',
];
var browsers = ['PhantomJS']; // for local builds
var sauceLaunchers = require('./tools/browsers_to_saucelabs')(require('./saucelab_browsers'));
if (process.env.TRAVIS) {
console.log('On Travis sending coveralls');
coverage_reporters.push( { type : 'lcov', dir : 'coverage' } );
reporters.push('coveralls');
} else {
console.log('Not on Travis so not sending coveralls');
coverage_reporters.push( { type : 'html', dir : 'coverage', 'subdir' : 'html' } );
}
if (process.env.SAUCE_USERNAME) {
console.log('Will use sauceLabs');
reporters.push('saucelabs');
browsers = Object.keys(sauceLaunchers);
} else {
console.log('No sauceLabs');
}
module.exports = function (config) {
config.set({
browsers: browsers,
coverageReporter: {
reporters: coverage_reporters,
},
files: [
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
'./node_modules/babel-polyfill/dist/polyfill.js',
'tests.webpack.js',
],
singleRun: !argv.watch,
frameworks: [
'mocha',
'chai-sinon',
'chai-as-promised',
'chai',
],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap'],
},
reporters: reporters,
mochaReporter: {
showDiff: true,
},
sauceLabs: {
testName: 'es6 library boilerplate',
},
customLaunchers: sauceLaunchers,
webpack: {
cache: true,
devtool: 'inline-source-map',
debug: true,
module: {
preLoaders: [
{
test: /spec\.js$/,
include: /src/,
exclude: /(bower_components|node_modules)/,
loader: 'babel',
query: {
cacheDirectory: true,
},
},
{
test: /\.js?$/,
include: /src/,
exclude: /(node_modules|bower_components|spec)/,
loader: 'babel-istanbul',
query: {
cacheDirectory: true,
},
},
],
loaders: [
{
test: /\.js$/,
include: path.resolve(__dirname, '../src'),
exclude: /(bower_components|node_modules|spec)/,
loader: 'babel',
query: {
cacheDirectory: true,
},
},
],
},
},
});
};