This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
92 lines (72 loc) · 2.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
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
'use strict';
var path = require('path');
var conf = require('./gulp/conf');
var _ = require('lodash');
var wiredep = require('wiredep');
function listFiles() {
var wiredepOptions = _.extend({}, conf.wiredep, {
dependencies: true,
devDependencies: true
});
return wiredep(wiredepOptions).js
.concat([
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.controller.js'),
path.join(conf.paths.src, '/app/components/**/*.module.js'),
path.join(conf.paths.src, '/app/components/**/*.service.js'),
path.join(conf.paths.src, '/**/*.spec.js'),
path.join(conf.paths.src, '/**/*.html')
]);
}
module.exports = function(config) {
var configuration = {
files: listFiles(),
exclude: [
path.join(conf.paths.src,'app/components/chart/*.js')
],
singleRun: true,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
frameworks: ['jasmine', 'angular-filesort'],
angularFilesort: {
whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')]
},
ngHtml2JsPreprocessor: {
stripPrefix: 'src/',
moduleName: 'ConsentManagement'
},
browsers : ['PhantomJS'],
plugins : [
'karma-jasmine',
'karma-angular-filesort',
'karma-phantomjs-launcher',
'karma-coverage',
'karma-ng-html2js-preprocessor'
],
reporters: ['progress', 'coverage'],
coverageReporter : {
type : 'lcov',
dir : 'coverage/',
subdir: '.'
},
preprocessors: {
'src/**/*.html': ['ng-html2js'],
'src/app/**/*.controller.js': ['coverage']
}
};
// 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);
};