-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.config.js
159 lines (136 loc) · 3.79 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2015-07-27 using
// generator-karma 1.0.0
var webpack = require('karma-webpack');
var path = require('path');
var rootDir = path.join(__dirname);
var specDir = path.join(__dirname, '/test/spec/unit');
var libDir = path.join(__dirname, '/src/lib');
var extensionsDir = path.join(__dirname, '/src/extensions');
var genericsDir = path.join(__dirname, '/src/generics');
var helpersDir = path.join(__dirname, '/src/helpers');
var specFilePattern = specDir + '/**/*.js';
var libFilePattern = libDir + '/**/*.js';
var extensionsFilePattern = extensionsDir + '/**/*.js';
var genericsFilePattern = genericsDir + '/**/*.js';
var helpersFilePattern = helpersDir + '/**/*.js';
var rootFilePattern = rootDir + '/src/complay*.js';
var configFilePattern = rootDir + '/src/default-config.js';
var preprocessors = {};
var preprocessorActions = ['webpack', 'sourcemap'];
preprocessors[rootFilePattern] = preprocessorActions;
preprocessors[configFilePattern] = preprocessorActions;
preprocessors[helpersFilePattern] = preprocessorActions;
preprocessors[extensionsFilePattern] = preprocessorActions;
preprocessors[genericsFilePattern] = preprocessorActions;
preprocessors[specFilePattern] = preprocessorActions;
preprocessors[libFilePattern] = preprocessorActions;
module.exports = function(config) {
'use strict';
config.set({
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// base path, that will be used to resolve files and exclude
basePath: './',
// testing framework to use (jasmine/mocha/qunit/...)
// as well as any additional frameworks (requirejs/chai/sinon/...)
frameworks: [
'mocha',
'chai',
'sinon'
],
// list of files / patterns to load in the browser
files: [
specFilePattern
],
// list of files / patterns to exclude
exclude: [
],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
preprocessors: preprocessors,
reporters: ['spec', 'coverage'],
coverageReporter: {
dir: 'build/reports/coverage',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' }
]
},
webpack: {
resolve: {
extensions: ['', '.js', '.jsx']
},
devtool: 'eval-source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/,
query: {
presets: ['react', 'es2015']
},
include: [
helpersDir,
extensionsDir,
genericsDir,
specDir,
libDir,
configFilePattern
]
}
],
postLoaders: [{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loaders: ['istanbul-instrumenter'],
include: libDir
}]
}
},
webpackMiddleware: { noInfo: true },
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [
'Chrome'
],
// Which plugins to enable
plugins: [
webpack,
'karma-mocha',
'karma-chai',
'karma-coverage',
'karma-sinon',
'karma-phantomjs-launcher',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-sourcemap-loader',
'karma-spec-reporter'
],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
colors: true,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_DEBUG,
// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};