This repository has been archived by the owner on May 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.config.js
126 lines (111 loc) · 2.7 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const karmaWebpack = require('karma-webpack');
const karmaMocha = require('karma-mocha');
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 webpackConfig = require('./webpack.config')[0];
const IS_COVERALLS = process.env.COVERAGE === 'coveralls';
const plugins = [
karmaWebpack,
karmaMocha,
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: [
'node_modules/babel-polyfill/dist/polyfill.js',
'app/**/*.spec.js',
],
frameworks: ['mocha'],
preprocessors: {
'app/**/*.spec.js': ['webpack'],
},
browserNoActivityTimeout: 30000,
browserDisconnectTimeout: 10000,
webpack: {
externals: {
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /(node_modules|.*\.spec.js)/,
loader: 'isparta',
},
{
test: /\.scss/,
loaders: [
'nebo15-isomorphic-style-loader',
'css?modules&importLoaders=1&sourceMap',
'postcss',
],
},
{
test: /\.css/,
loaders: [
'nebo15-isomorphic-style-loader',
'css',
'postcss',
],
},
{
test: /\.(woff|woff2|eot|ttf)(\?.*$|$)/,
loader: 'file',
},
{
test: /.*\.(gif|png|jpe?g)$/i,
loaders: [
'file?name=[name].[ext]?[hash]',
],
},
{
test: /\.svg/i,
loader: 'svg-inline',
},
{
test: /\.json/i,
loader: 'json-loader',
},
],
},
postcss: webpackConfig.postcss,
},
webpackMiddleware: {
noInfo: true,
},
browsers: ['PhantomJS'],
client: {
mocha: {
timeout: 6000, // 6 seconds - upped from 2 seconds
},
},
coverageReporter: {
type: 'lcov',
dir: './coverage',
},
});
};