-
Notifications
You must be signed in to change notification settings - Fork 19
/
karma.conf.js
85 lines (83 loc) · 2.15 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
const webpack = require('webpack');
const getNetworkConfig = require('./lib/test/getNetworkConfig');
const { inventory, variables } = getNetworkConfig();
module.exports = (config) => {
config.set({
client: {
testVariables: {
inventory,
variables,
},
mocha: {
timeout: 15000, // set timeout for mocha when running karma browser tests
},
},
});
config.set({
frameworks: ['mocha', 'chai', 'webpack'],
files: [
'lib/test/karma/loader.js',
],
preprocessors: {
'lib/test/karma/loader.js': ['webpack'],
},
webpack: {
mode: 'development',
optimization: {
minimize: false,
},
resolve: {
fallback: {
dns: false,
tls: false,
http2: false,
zlib: false,
fs: false,
path: false,
net: false,
os: false,
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
assert: require.resolve('assert/'),
string_decoder: require.resolve('string_decoder/'),
stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'),
buffer: require.resolve('buffer/'),
events: require.resolve('events/'),
url: require.resolve('url/'),
util: require.resolve('util/'),
},
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
},
plugins: [
'karma-mocha',
'karma-mocha-reporter',
'karma-chai',
'karma-chrome-launcher',
'karma-webpack',
],
reporters: ['mocha'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['chromeWithoutSecurity'],
customLaunchers: {
chromeWithoutSecurity: {
base: 'ChromeHeadless',
flags: ['--ignore-certificate-errors', '--no-sandbox'],
displayName: 'Chrome w/o security',
},
},
singleRun: false,
concurrency: Infinity,
});
};