-
Notifications
You must be signed in to change notification settings - Fork 211
/
karma.conf.js
100 lines (84 loc) · 2.51 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
92
93
94
95
96
97
98
99
100
var path = require('path');
var webpack = require('webpack');
var defaults = require('./defaults');
var defaultsPlugin = new webpack.DefinePlugin(defaults);
module.exports = function (config) {
config.set({
browsers: ['ChromeHeadless'],
// The Travis environment has these specified.
// To run BrowserStack tests locally, specify the environment variables:
// BROWSER_STACK_USERNAME, BROWSER_STACK_ACCESS_KEY
browserStack: {
username: null,
accessKey: null,
},
client: {
captureConsole: true,
},
// Files are specified in the grunt-karma configuration in Gruntfile.js
//files: []
frameworks: ['mocha', 'expect', 'chai', 'sinon', 'jquery-1.9.0'],
logLevel: 'INFO',
// Default is 1000 but we can run into rate limit issues so bump it up to 10k
pollingTimeout: 10000,
// run the bundle through the webpack and sourcemap plugins
preprocessors: {
'test/**/!(requirejs).test.js': ['webpack', 'sourcemap'],
'**/*.html': ['html2js'],
},
proxies: {
'/dist/': '/base/dist/',
'/examples/': '/base/examples/',
},
customHeaders: [
// Allow CSP error testing, but leave enough enabled so that karma
// can still run correctly.
{
match: '\\.html',
name: 'Content-Security-Policy',
value: "default-src 'self' 'unsafe-inline' 'unsafe-eval';",
},
],
reporters: ['progress'],
singleRun: true,
// Use "polling" and JSONP for older browsers
transports: ['polling'],
forceJSONP: true,
webpack: {
plugins: [defaultsPlugin],
devtool: 'inline-source-map',
performance: { hints: false },
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'eslint-loader',
exclude: [/node_modules/, /vendor/, /lib/, /dist/],
options: {
configFile: path.resolve(__dirname, '.eslintrc'),
},
},
{
test: /\.js$/,
loader: 'strict-loader',
exclude: [/node_modules/, /vendor/, /lib/, /dist/, /test/],
},
{
test: /(mootootls|requirejs)\.js$/,
loader: 'script',
},
{
enforce: 'post',
test: /\.js$/,
exclude: [/node_modules/, /vendor/, /lib/, /dist/, /test/],
loader: 'coverage-istanbul-loader',
},
],
},
},
webpackMiddleware: {
noInfo: true,
},
});
};