forked from pubkey/rxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
131 lines (113 loc) · 3.45 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
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
// while the karma tests run, we need some things which we start here
const { startTestServers, TEST_STATIC_FILE_SERVER_PORT } = require('../test_tmp/helper/test-servers');
startTestServers();
// karma config
const configuration = {
basePath: '',
frameworks: [
'mocha',
'webpack',
'detectBrowsers'
],
webpack: require('./karma.webpack.conf'),
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'../test_tmp/unit.test.js': ['webpack', 'sourcemap']
},
files: [
'../test_tmp/unit.test.js'
],
port: 9876,
colors: true,
autoWatch: false,
/**
* Serve these static files from the same port
* so we can use it to server web-workers and stuff
* and access them with same-origin-restricted code.
*/
proxies: {
'/files': 'http://localhost:' + TEST_STATIC_FILE_SERVER_PORT + '/files'
},
/**
* see
* @link https://github.com/litixsoft/karma-detect-browsers
*/
detectBrowsers: {
enabled: true,
usePhantomJS: false,
postDetection: function (availableBrowser) {
// respect cli args overwrites
const indexOfBrowsers = process.argv.indexOf('--browsers');
if (indexOfBrowsers > 0) {
return [process.argv[indexOfBrowsers + 1]];
}
// return ['Chrome'];
// return ['Firefox'];
const doNotUseTheseBrowsers = [
'PhantomJS',
'SafariTechPreview',
'FirefoxAurora',
'FirefoxNightly',
'ChromeCanary'
];
const browsers = availableBrowser
.filter(b => !doNotUseTheseBrowsers.includes(b));
return browsers;
}
},
// Karma plugins loaded
plugins: [
'karma-mocha',
'karma-webpack',
'karma-chrome-launcher',
'karma-safari-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-opera-launcher',
'karma-detect-browsers',
'karma-spec-reporter',
'karma-sourcemap-loader'
],
client: {
mocha: {
bail: true,
/**
* Yes we need a really big value here
* because the CI servers have a non-predictable
* computation power and sometimes they can be really slow.
*/
timeout: 120000
},
/**
* Pass all env variables here,
* so that they can be used in the browsers JavaScript process.
* @link https://stackoverflow.com/a/38879184
*/
env: process.env
},
browserDisconnectTimeout: 120000,
processKillTimeout: 120000,
singleRun: true,
/**
* Use this reported to fully log all test names
* which makes it easier to debug.
* @link https://github.com/tmcgee123/karma-spec-reporter
*/
reporters: ['spec']
};
if (process.env.CI) {
console.log('# Use CI settings.');
/**
* overwrite reporters-default
* So no big list will be shown at log
*/
// configuration.reporters = [];
// how many browser should be started simultaneously
configuration.concurrency = 1;
}
module.exports = function (config) {
// console.log('karma config:');
// console.dir(configuration);
config.set(configuration);
};