-
Notifications
You must be signed in to change notification settings - Fork 7
/
karma.conf.js
72 lines (67 loc) · 1.92 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
const assign = require('lodash.assign')
const webpackConfig = require('./webpack.config')
const browsers = require('./browsers')
const isBench = process.env.BENCHMARK === 'true'
const useCloud = process.env.USE_CLOUD === 'true'
const browserStackUserName = process.env.BROWSER_STACK_USERNAME
const browserStackAccessKey = process.env.BROWSER_STACK_ACCESS_KEY
const isTravis = process.env.TRAVIS
const travisBuildNumber = process.env.TRAVIS_BUILD_NUMBER
const travisBuildId = process.env.TRAVIS_BUILD_ID
const travisJobNumber = process.env.TRAVIS_JOB_NUMBER
module.exports = (config) => {
config.set({
customLaunchers: browsers,
browsers: ['Chrome', 'Firefox', 'Safari'],
frameworks: ['mocha'],
files: [
'node_modules/es5-shim/es5-shim.js',
'node_modules/es5-shim/es5-sham.js',
'tests.webpack.js'
],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap']
},
webpack: assign(webpackConfig, {
devtool: 'inline-source-map'
}),
webpackServer: {
noInfo: true
},
reporters: ['mocha', 'coverage'],
coverageReporter: {
dir: 'coverage',
file: 'coverage.json',
type: 'json'
}
})
if (isBench) {
assign(config, {
browsers: ['Chrome'],
frameworks: ['benchmark'],
files: ['benchmark/**/*.js'],
preprocessors: {'benchmark/**/*.js': ['webpack']},
reporters: ['benchmark']
})
}
if (useCloud) {
assign(config, {
browsers: Object.keys(browsers),
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 30000,
captureTimeout: 200000
})
config.browserStack = {
username: browserStackUserName,
accessKey: browserStackAccessKey,
pollingTimeout: 10000
}
if (isTravis) {
assign(config.browserStack, {
build: `TRAVIS #${travisBuildNumber} (${travisBuildId})`,
name: travisJobNumber
})
}
}
}