-
Notifications
You must be signed in to change notification settings - Fork 38
/
karma.conf.js
65 lines (61 loc) · 1.42 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
'use strict';
var env = require('./gulpfile.env');
module.exports = function(karma) {
var config = {
basePath: '',
/**
* @param browsers {Array} List of browsers for Karma to run the tests against.
* We can use `Chrome`, `Firefox` or `PhantomJS` out-of-the-box here.
*/
browsers: ['PhantomJS'],
frameworks: ['jasmine'],
files: [
...env.test.libs.js,
{ pattern: '.karma/**/*.js', included: false }
],
plugins: [
'karma-jasmine',
'karma-coverage',
'karma-spec-reporter',
'karma-firefox-launcher',
'karma-chrome-launcher',
'karma-phantomjs-launcher'
],
reporters: [
'spec',
'coverage'
],
preprocessors: {
/**
* Source files, that you want to generate coverage for.
* Do not include tests or libraries.
* These files will be instrumented by Istanbul.
*/
'.karma/**/!(*.spec).js': 'coverage'
},
coverageReporter: {
type: 'json',
subdir: './json',
file: 'coverage-js.json'
},
singleRun: true,
port: 9876,
colors: true,
logLevel: karma.LOG_INFO,
customLaunchers: {
ChromeTravisCI: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
};
/**
* `PhantomJS2` support is limited in Travis CI so we use `Chrome` instead.
* Note that we also need to configure Travis so it enables Chrome.
* See `before_script` in the `.travis.yml` file.
*/
if (process.env.TRAVIS) {
config.browsers = ['ChromeTravisCI'];
}
karma.set(config);
};