forked from Workiva/wGulp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
40 lines (36 loc) · 1.33 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
module.exports = function(karma) {
var fs = require('fs');
var cwd = process.cwd();
var path = require('path');
var lodash = require('lodash');
var polyfill = path.resolve(cwd, "node_modules/wGulp/src/function-bind-polyfill.js");
var defaultConfiguration = {
basePath: path.resolve(cwd),
browsers: ["PhantomJS"],
files: [polyfill],
frameworks: ['jspm', 'jasmine'],
jspm: {
loadFiles: ['build/test/**/*.js'],
serveFiles: ['build/**', 'src/**', 'test/**']
},
reporters: ['progress', 'junit', 'html'],
junitReporter: {
outputFile: './report/tests/test-results.xml'
},
coverageReporter: {
dir: 'report/coverage/'
},
singleRun: false,
autoWatch: true
};
var karmaShim = {set: function(config) { this.config = config; }};
var localKarmaConfig = path.resolve(cwd, "karma.conf.js");
if (fs.existsSync(localKarmaConfig)) {
var localKarmaFunction = require(localKarmaConfig);
localKarmaFunction(karmaShim);
}
var configuration = lodash.merge(defaultConfiguration, karmaShim.config);
// manually concatenate files array
configuration.files = [].concat(defaultConfiguration.files, configuration.files || []);
karma.set(configuration);
};