-
Notifications
You must be signed in to change notification settings - Fork 3
/
karma.config.js
99 lines (84 loc) · 2.04 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
99
const webpack = require('webpack');
const karmaWebpack = require('karma-webpack');
const karmaMocha = require('karma-mocha');
const karmaChai = require('karma-chai');
const karmaSinon = require('karma-sinon');
const karmaCoverage = require('karma-coverage');
const karmaPhantomjsLauncher = require('karma-phantomjs-launcher');
const karmaSourcemapLoader = require('karma-sourcemap-loader');
const karmaSpecReporter = require('karma-spec-reporter');
const karmaCoveralls = require('karma-coveralls');
const webpackMerge = require('webpack-merge');
const parts = require('./webpack/parts');
const IS_COVERALLS = process.env.COVERAGE === 'coveralls';
const webpackTestConfig = webpackMerge(
parts.setupJs(),
parts.setupCssCritical(),
parts.setupFont(),
parts.setupFontGenCritical(),
parts.setupImages(),
parts.setupJson(),
parts.setupI18n(),
{
externals: {
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
},
plugins: [
new webpack.DefinePlugin({
__CLIENT__: false,
}),
],
}
);
const plugins = [
karmaWebpack,
karmaMocha,
karmaChai,
karmaSinon,
karmaCoverage,
karmaPhantomjsLauncher,
karmaSourcemapLoader,
karmaSpecReporter,
];
const reporters = [
'spec',
'coverage',
];
if (IS_COVERALLS) {
plugins.push(karmaCoveralls);
reporters.push('coveralls');
}
module.exports = (config) => {
config.set({
basePath: '.',
reporters,
plugins,
files: [
'app/common/components/Icon/index.spec.js',
],
frameworks: ['mocha'],
preprocessors: {
'app/**/*.spec.js': ['webpack'],
},
browserNoActivityTimeout: 30000,
browserDisconnectTimeout: 10000,
webpack: webpackTestConfig,
webpackMiddleware: {
noInfo: true,
stats: 'errors-only',
},
browsers: ['PhantomJS'],
client: {
mocha: {
timeout: 6000, // 6 seconds - upped from 2 seconds
},
},
coverageReporter: {
type: 'lcov',
dir: './coverage',
},
concurrency: Infinity,
});
};