-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
executable file
·103 lines (83 loc) · 2.63 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
'use strict';
var path = require('path');
var conf = require('./gulpfile.config');
var _ = require('lodash');
var wiredep = require('wiredep');
/*
* list all files that we want to load in the browser
*/
function listFiles() {
var wiredepOptions = _.extend({}, conf.wiredep, {
dependencies: true,
devDependencies: true
});
return wiredep(wiredepOptions).js
.concat([path.join(conf.paths.tmp, '**/*.js')]);
}
var preprocessors = {};
preprocessors[path.join(conf.paths.tmp, '**/*.js')] = ['coverage', 'sourcemap'];
module.exports = function(config) {
var configuration = {
// List of files/patterns to load in the browser
files: listFiles(),
// Continuous Integration mode
// If true, it capture browsers, run tests and exit
singleRun: true,
// Enable or disable watching files and executing the tests whenever one of these files changes.
autoWatch: false,
// Level of logging, can be: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// Testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
// List of plugins to load
plugins: [
'karma-phantomjs-launcher',
'karma-chrome-launcher',
'karma-jasmine',
'karma-coverage',
'karma-junit-reporter',
'karma-sourcemap-loader'
],
// A map of preprocessors to use
preprocessors: preprocessors,
// List of reporters
reporters: ['coverage', 'junit', 'progress'],
// Coverage configuration
coverageReporter: {
type: 'lcov',
dir: 'reports/',
subdir: 'coverage'
},
junitReporter: {
outputDir: 'reports/junit/',
outputFile: 'TESTS-xunit.xml',
useBrowserName: false,
suite: '' // suite will become the package name attribute in xml testsuite element
},
// Enable or disable colors in the output (reporters and logs).
color: true
};
// This block is needed to execute Chrome on Travis
// If you ever plan to use Chrome and Travis, you can keep it
// If not, you can safely remove it
// https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076
if (configuration.browsers[0] === 'Chrome' && process.env.TRAVIS) {
configuration.customLaunchers = {
'chrome-travis-ci': {
base: 'Chrome',
flags: ['--no-sandbox']
}
};
configuration.browsers = ['chrome-travis-ci'];
}
config.set(configuration);
};