This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkarma.conf.js
148 lines (138 loc) · 3.73 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
module.exports = function (config) {
var specPattern = 'test/!(e2e)/*.spec.js'
var customLaunchers = {
'SL_CHROME': {
base: 'SauceLabs',
browserName: 'chrome',
version: '46'
},
'SL_FIREFOX': {
base: 'SauceLabs',
browserName: 'firefox',
version: '42'
},
'SL_SAFARI9': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '9.0'
},
'SL_IE11': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
'SL_IE10': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 2012',
version: '10'
},
'SL_EDGE': {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
version: '13'
},
'SL_ANDROID4.4': {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
},
'SL_IOS9': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.1'
}
}
var cfg = {
exclude: [
'e2e/**/*.*'
],
files: [
'test/utils/polyfill.js',
specPattern,
{ pattern: 'test/exceptions/data/*.js', included: false, watched: false },
{ pattern: 'src/**/*.js', included: false, watched: true }
],
frameworks: ['browserify', 'jasmine'],
plugins: [
'karma-sauce-launcher',
'karma-failed-reporter',
'karma-jasmine',
'karma-spec-reporter',
'karma-browserify'
],
browserNoActivityTimeout: 60000,
customLaunchers: customLaunchers,
browsers: [], // Chrome, Firefox, PhantomJS2
captureTimeout: 120000, // on saucelabs it takes some time to capture browser
reporters: ['spec', 'failed'],
browserify: {
debug: true,
configure: function (bundle) {
var proxyquire = require('proxyquireify')
bundle
.plugin(proxyquire.plugin)
}
},
sauceLabs: {
testName: 'OpbeatJS',
startConnect: false,
recordVideo: false,
recordScreenshots: true,
options: {
'selenium-version': '2.48.2',
'command-timeout': 600,
'idle-timeout': 600,
'max-duration': 5400
}
}
}
cfg.preprocessors = {}
cfg.preprocessors[specPattern] = ['browserify']
var isTravis = process.env.TRAVIS
var isSauce = process.env.MODE && process.env.MODE.startsWith('saucelabs')
var buildId
var version = require('./package').version
console.log('MODE: ' + process.env.MODE)
if (isTravis) {
buildId = 'OpbeatJS@' + version + ' - TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'
// 'karma-chrome-launcher',
cfg.plugins.push('karma-firefox-launcher')
cfg.browsers.push('Firefox')
} else {
buildId = 'OpbeatJS@' + version
cfg.plugins.push('karma-chrome-launcher')
cfg.browsers.push('Chrome')
if (config.coverage) {
// istanbul code coverage
cfg.plugins.push('karma-coverage')
var istanbul = require('browserify-istanbul')
cfg.browserify.transform = [istanbul]
cfg.coverageReporter = {
includeAllSources: true,
reporters: [
{type: 'html', dir: 'coverage/'},
{type: 'text-summary'}
],
dir: 'coverage/'
}
cfg.preprocessors['src/**/*.js'] = ['coverage']
cfg.reporters.push('coverage')
}
// cfg.plugins.push('karma-phantomjs2-launcher')
// cfg.browsers.push('PhantomJS2')
}
if (isSauce) {
cfg.concurrency = 3
cfg.sauceLabs.build = buildId
cfg.reporters = ['dots', 'saucelabs']
cfg.browsers = Object.keys(customLaunchers)
cfg.transports = ['polling']
}
config.set(cfg)
}