1
1
var buildConfig = require ( './build.config.js' ) ;
2
2
var path = require ( 'canonical-path' ) ;
3
3
4
- module . exports = {
5
- files : [
4
+ module . exports = function ( includeCodeCoverage ) {
5
+ console . log ( "in the function" ) ;
6
+ var config = { } ;
7
+
8
+ config . files = [
6
9
// Include jQuery only for testing convience (lots of DOM checking for unit tests on directives)
7
10
'http://codeorigin.jquery.com/jquery-1.10.2.min.js' ,
8
11
'config/lib/js/angular/angular.js' ,
@@ -12,47 +15,49 @@ module.exports = {
12
15
'config/lib/js/angular-ui/angular-ui-router.js' ,
13
16
'config/lib/testutil.js'
14
17
]
15
- . concat ( buildConfig . ionicFiles )
16
- . concat ( buildConfig . angularIonicFiles )
17
- . concat ( 'test/unit/**/*.js' ) ,
18
-
19
- exclude : [
20
- 'js/ext/angular/test/dom-trace.js'
21
- ] ,
22
- preprocessors : {
23
- 'js/**/*.js' : 'coverage'
24
- } ,
25
- frameworks : [ 'jasmine' ] ,
26
- reporters : [ 'progress' , 'coverage' ] ,
27
- port : 9876 ,
28
- colors : true ,
29
- // possible values: 'OFF', 'ERROR', 'WARN', 'INFO', 'DEBUG'
30
- logLevel : 'INFO' ,
31
- autoWatch : true ,
32
- captureTimeout : 60000 ,
33
- singleRun : false ,
34
- mochaReporter : {
18
+ . concat ( buildConfig . ionicFiles )
19
+ . concat ( buildConfig . angularIonicFiles )
20
+ . concat ( 'test/unit/**/*.js' ) ;
21
+
22
+ config . exclude = [ 'js/ext/angular/test/dom-trace.js' ] ;
23
+
24
+ config . frameworks = [ 'jasmine' ] ;
25
+
26
+ config . reporters = [ 'progress' ] ;
27
+
28
+ config . port = 9876 ;
29
+ config . colors = true ;
30
+ config . logLevel = 'INFO' ;
31
+ config . autoWatch = true ;
32
+ config . captureTimeout = 60000 ;
33
+ config . singleRun = false ;
34
+ config . mochaReporter = {
35
35
output : 'full'
36
- } ,
37
- coverageReporter : {
38
- reporters : [ {
39
- type : 'text'
40
- } , {
41
- type : 'text-summary'
42
- } , {
43
- type : 'cobertura' ,
44
- file : 'coverage.xml'
45
- } , {
46
- type : 'lcov'
47
- } ]
48
- } ,
49
- // Start these browsers, currently available:
50
- // - Chrome
51
- // - ChromeCanary
52
- // - Firefox
53
- // - Opera (has to be installed with `npm install karma-opera-launcher`)
54
- // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
55
- // - PhantomJS
56
- // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
57
- browsers : [ 'Chrome' ]
58
- } ;
36
+ } ;
37
+
38
+ config . browsers = [ 'Chrome' ] ;
39
+
40
+ if ( includeCodeCoverage ) {
41
+ config . preprocessors = { 'js/**/*.js' : 'coverage' } ;
42
+ config . reporters . push ( 'coverage' ) ;
43
+ config . coverageReporter = {
44
+ reporters : [
45
+ {
46
+ type : 'text'
47
+ } ,
48
+ {
49
+ type : 'text-summary'
50
+ } ,
51
+ {
52
+ type : 'cobertura' ,
53
+ file : 'coverage.xml'
54
+ } ,
55
+ {
56
+ type : 'lcov'
57
+ }
58
+ ]
59
+ } ;
60
+ }
61
+
62
+ return config ;
63
+ }
0 commit comments