forked from webex/webex-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
124 lines (94 loc) · 2.71 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
'use strict';
var pkg = require('./package');
module.exports = function(config) {
var browsers = require('./browsers');
var launchers = Object.keys(browsers).reduce(function(launchers, browserType) {
if (browserType === 'local') {
return launchers;
}
Object.keys(browsers[browserType]).forEach(function(browserKey) {
launchers[browserKey] = browsers[browserType][browserKey];
});
return launchers;
}, {});
var cfg = {
basePath: '.',
browserDisconnectTimeout: 10000,
browsers: process.env.SC_TUNNEL_IDENTIFIER ? Object.keys(launchers) : Object.keys(browsers.local),
browserDisconnectTolerance: 3,
browserify: {
debug: true,
watch: true,
transform: [
'envify'
]
},
browserNoActivityTimeout: 240000,
// Inspired by Angular's karma config as recommended by Sauce Labs
captureTimeout: 0,
colors: !process.env.XUNIT,
customLaunchers: launchers,
files: [
'test/unit/spec/**/*.js',
'test/integration/spec/**/*.js'
],
frameworks: [
'browserify',
'mocha'
],
hostname: '127.0.0.1',
client: {
mocha: {
retries: (process.env.JENKINS || process.env.CI) ? 1 : 0,
timeout: 30000
}
},
mochaReporter: {
// Hide the skipped tests on jenkins to more easily see which tests failed
ignoreSkipped: true
},
port: parseInt(process.env.KARMA_PORT) || 9001,
preprocessors: {
'src/**/*.js': ['browserify'],
'test/unit/spec/**/*.js': ['browserify'],
'test/integration/spec/**/*.js': ['browserify']
},
proxies: {
'/fixtures/': 'http://127.0.0.1:' + process.env.FIXTURE_PORT + '/',
'/upload': 'http://127.0.0.1:' + process.env.FIXTURE_PORT + '/upload'
},
reporters: [
'mocha'
],
singleRun: true
};
if (process.env.COVERAGE && process.env.COVERAGE !== 'undefined') {
cfg.coverageReporter = {
reporters: [{
type: 'json',
dir: 'reports/coverage/legacy'
}]
};
cfg.browserify.transform.push('browserify-istanbul');
cfg.reporters.push('coverage');
}
if (process.env.SC_TUNNEL_IDENTIFIER) {
cfg.sauceLabs = {
build: process.env.BUILD_NUMBER || ('local-' + process.env.USER + '-' + Date.now()),
startConnect: false,
testName: pkg.name + ' (karma)',
tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER
};
cfg.reporters.push('saucelabs');
}
if (process.env.XUNIT) {
cfg.junitReporter = {
outputFile: 'karma-legacy.xml',
outputDir: process.env.XUNIT_DIR || 'reports/junit',
suite: 'karma-legacy',
useBrowserName: true
};
cfg.reporters.push('junit');
}
config.set(cfg);
};