-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
160 lines (149 loc) · 4 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
149
150
151
152
153
154
155
156
157
158
159
160
const path = require('path');
const webpackConfig = require('./webpack.config')[0];
const USING_TRAVISCI = Boolean(process.env.TRAVIS);
const USING_SL = Boolean(process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY);
const SL_LAUNCHERS = {
'sl-chrome-stable': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest',
platform: 'macOS 10.12',
},
'sl-chrome-beta': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'beta',
platform: 'macOS 10.12',
},
'sl-chrome-previous': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest-1',
platform: 'macOS 10.12',
},
'sl-firefox-stable': {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest',
platform: 'Windows 10',
},
'sl-firefox-previous': {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest-1',
platform: 'Windows 10',
},
'sl-ie': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11',
platform: 'Windows 8.1',
},
// TODO: Re-enable Edge and Safari after Sauce Labs problems are fixed.
// 'sl-edge': {
// base: 'SauceLabs',
// browserName: 'microsoftedge',
// version: 'latest',
// platform: 'Windows 10',
// },
// 'sl-safari-stable': {
// base: 'SauceLabs',
// browserName: 'safari',
// version: 'latest',
// platform: 'macOS 10.12',
// },
// 'sl-safari-previous': {
// base: 'SauceLabs',
// browserName: 'safari',
// version: '9.0',
// platform: 'OS X 10.11',
// },
'sl-ios-safari-latest': {
base: 'SauceLabs',
deviceName: 'iPhone Simulator',
platformVersion: '10.0',
platformName: 'iOS',
browserName: 'Safari',
},
// 'sl-ios-safari-previous': {
// base: 'SauceLabs',
// deviceName: 'iPhone Simulator',
// platformVersion: '9.3',
// platformName: 'iOS',
// browserName: 'Safari',
// },
};
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'test/unit/index.js',
],
preprocessors: {
'test/unit/index.js': ['webpack', 'sourcemap'],
},
reporters: ['dots', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: determineBrowsers(),
browserDisconnectTimeout: 40000,
browserNoActivityTimeout: 120000,
captureTimeout: 240000,
concurrency: USING_SL ? 4 : Infinity,
customLaunchers: SL_LAUNCHERS,
coverageReporter: {
dir: 'coverage',
reporters: [
{type: 'lcovonly', subdir: '.'},
{type: 'json', subdir: '.', file: 'coverage.json'},
{type: 'html'},
],
},
client: {
mocha: {
reporter: 'html',
ui: 'qunit',
},
},
webpack: Object.assign({}, webpackConfig, {
devtool: 'inline-source-map',
module: Object.assign({}, webpackConfig.module, {
// Cover source files when not debugging tests. Otherwise, omit coverage instrumenting to get
// uncluttered source maps.
rules: webpackConfig.module.rules.concat([config.singleRun ? {
test: /\.js$/,
include: path.resolve('./packages'),
exclude: [
/node_modules/,
/adapter.js/,
],
loader: 'istanbul-instrumenter-loader',
query: {esModules: true},
} : undefined]).filter(Boolean),
}),
}),
webpackMiddleware: {
noInfo: true,
},
});
// See https://github.com/karma-runner/karma-sauce-launcher/issues/73
if (USING_TRAVISCI) {
config.set({
sauceLabs: {
testName: 'AD Framework Unit Tests - CI',
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
username: process.env.SAUCE_USERNAME,
accessKey: process.env.SAUCE_ACCESS_KEY,
startConnect: false,
},
// Attempt to de-flake Sauce Labs tests on TravisCI.
transports: ['polling'],
browserDisconnectTolerance: 3,
});
}
};
function determineBrowsers() {
return USING_SL ? Object.keys(SL_LAUNCHERS) : ['Chrome'];
}