-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
107 lines (88 loc) · 2.27 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
'use strict';
var babel = require('babelify');
var cover = require('browserify-istanbul');
var coverOptions = {
ignore: [
'**/*.spec.js',
'**/*.spec.mock.js',
'**/*.spec.es6',
'**/*.spec.mock.es6',
'**/*.html'
],
defaultIgnore: true
};
var karma_browsers = ['Chrome'];
if(process.env.BUILDSERVER === 'headless')
karma_browsers = ['PhantomJS'];
module.exports = function(config) {
config.set({
basePath: './',
frameworks: ['browserify', 'source-map-support', 'jasmine', 'phantomjs-shim'],
browserNoActivityTimeout: 60000,
browsers: karma_browsers,
reporters: ['progress', 'junit', 'coverage'],
autoWatch: true,
autoWatchBatchDelay: 500,
plugins: [
'karma-jasmine',
'karma-browserify',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-firefox-launcher',
'karma-safari-launcher',
'karma-ie-launcher',
'karma-phantomjs-shim',
'karma-junit-reporter',
'karma-coverage',
'karma-ng-html2js-preprocessor',
'karma-source-map-support'
],
files: [
// app-specific code
'app/js/main.js',
// 3rd-party resources
'node_modules/angular-mocks/angular-mocks.js',
// test files
'app/**/*.spec.js',
'app/**/*.spec.es6',
// angular templates
'app/js/**/*.html'
],
preprocessors: {
'app/js/**/*.js': ['browserify'],
'app/js/**/*.es6': ['browserify'],
'app/js/**/*.html': ['ng-html2js']
},
browserify: {
debug: true,
config: {
watchify: {
poll: true
}
},
bundleDelay: 2500,
extensions: [".js",".es6"],
configure: function(bundle) {
bundle.on('prebundle', function() {
bundle
.transform(babel.configure({ extensions: ['.es6'], auxiliaryComment: 'istanbul ignore next' }))
.transform(cover(coverOptions))
.plugin('proxyquire-universal');
});
}
},
ngHtml2JsPreprocessor: {
moduleName: 'karma.templates'
},
junitReporter: {
outputFile: 'logs/unit.test.xml',
suite: ''
},
coverageReporter: {
type: 'cobertura',
dir: 'logs/coverage',
subdir: '.',
file: 'cobertura-coverage.xml'
}
});
};