forked from kaltura/playkit-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
71 lines (67 loc) · 1.94 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
const isWindows = /^win/.test(process.platform);
const isMacOS = /^darwin/.test(process.platform);
// Create custom launcher in case running with Travis
const customLaunchers = {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required', '--max-web-media-player-count=1000']
}
};
const launchers = {
Chrome_browser: {
base: 'Chrome',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required', '--max-web-media-player-count=1000']
}
};
module.exports = function (config) {
let karmaConf = {
logLevel: config.LOG_INFO,
browserDisconnectTimeout: 30000,
browserNoActivityTimeout: 60000,
customLaunchers: launchers,
browsers: ['Chrome_browser', 'Firefox'],
concurrency: 1,
singleRun: true,
colors: true,
frameworks: ['mocha'],
files: [
'node_modules/regenerator-runtime/runtime.js',
'test/setup/karma.js',
{
pattern: 'test/src/assets/*',
included: false
}
],
preprocessors: {
'src/**/*.js': ['webpack', 'sourcemap'],
'test/setup/karma.js': ['webpack', 'sourcemap']
},
reporters: ['mocha', 'coverage'],
webpack: {
...require('./webpack.config.js'),
externals: {}, //Need to remove externals otherwise they won't be included in test
devtool: 'inline-source-map', // Need to define inline source maps when using karma
mode: config.mode || 'development' // run in development mode by default to avoid minifying -> faster
},
webpackServer: {
noInfo: true
},
client: {
mocha: {
reporter: 'html',
timeout: 50000
}
}
};
if (process.env.TRAVIS) {
karmaConf.customLaunchers = customLaunchers;
karmaConf.browsers = ['Chrome_travis_ci'];
} else {
if (isWindows) {
karmaConf.browsers.push('IE');
} else if (isMacOS) {
karmaConf.browsers.push('Safari');
}
}
config.set(karmaConf);
};