forked from cloudflare/react-modal2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
140 lines (119 loc) · 3.18 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
'use strict';
var customLaunchers = {};
var minimist = require('minimist');
var defined = require('defined');
var args = minimist(process.argv.slice(2), {
string: ['env', 'build-branch', 'build-number', 'suace-username', 'sauce-key'],
'default': {
env: process.env.NODE_ENV,
'build-branch': process.env.BUILD_BRANCH,
'build-number': process.env.BUILD_NUMBER,
'sauce-username': process.env.SAUCE_USERNAME,
'sauce-key': process.env.SAUCE_ACCESS_KEY
}
});
args.istanbul = defined(args.istanbul, args.env !== 'CI');
args['sauce-labs'] = defined(args['sauce-labs'], args.env === 'CI');
// Overridable arguments are denoted below. Other arguments can be found in the
// [Karma configuration](http://karma-runner.github.io/0.12/config/configuration-file.html)
['chrome', 'firefox', 'iphone', 'ipad', 'android'].forEach(function(browser) {
customLaunchers['sl_' + browser] = {
base: 'SauceLabs',
browserName: browser
};
});
// Safari defaults to version 5 on Windows 7 (huh?)
customLaunchers.sl_safari = {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.9'
};
[9, 10, 11].forEach(function(version) {
customLaunchers['sl_ie_' + version] = {
base: 'SauceLabs',
browserName: 'internet explorer',
version: version
};
});
var reporters = ['mocha', 'beep'];
if (args.istanbul) {
reporters.push('coverage');
}
module.exports = function(config) {
config.set({
frameworks: ['browserify', 'mocha'],
files: [
{
pattern: 'http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js',
watched: false,
included: true,
served: false
},
{
pattern: 'test/**/*.js',
watched: true,
included: true,
served: true
}
],
preprocessors: {
'test/**/*.js': ['browserify']
},
// Overridable with a comma-separated list with `--reporters`
reporters: reporters,
// Overridable with `[--no]-colors
colors: true,
/* Overridable with `--log-level=<level>`.
*
* Possible 'level' options include:
* * disable
* * error
* * warn
* * info
* * debug
*/
logLevel: config.LOG_INFO,
// Overridable with a comma-separated list with `--browsers`
browsers: args['sauce-labs'] ? Object.keys(customLaunchers) : [
'Chrome',
'Firefox',
'Safari'
],
sauceLabs: {
username: args['sauce-username'],
accessKey: args['sauce-key'],
testName: require('./package.json').name,
tags: args['build-branch'],
build: args['build-number']
},
browserify: {
debug: true,
transform: [
'babelify'
].concat(args.istanbul && [
['browserify-istanbul', {
ignore: ['**/*.handlebars'],
instrumenter: require('isparta')
}]
] || [])
},
coverageReporter: {
reporters: [
{
type: 'html'
},
{
type: 'text'
}
]
},
client: {
// '--grep' arguments are passed directly to mocha.
args: args.grep && ['--grep', args.grep],
mocha: {
reporter: 'html'
}
},
customLaunchers: customLaunchers
});
};