1
- module . exports = function ( config ) {
1
+ module . exports = function ( config ) {
2
+
3
+ var appBase = 'lib/' ; // transpiled app JS and map files
4
+ var appSrcBase = 'src/' ; // app source TS files
5
+ var appAssets = '/base/lib/' ; // component assets fetched by Angular's compiler
6
+
2
7
config . set ( {
3
8
4
9
basePath : '.' ,
5
10
6
11
frameworks : [ 'jasmine' ] ,
7
12
8
- files : [
9
- // paths loaded by Karma
10
- 'node_modules/traceur/bin/traceur-runtime.js' ,
11
- { pattern : 'node_modules/core-js/client/shim.js' , included : true , watched : true } ,
12
- { pattern : 'node_modules/zone.js/dist/zone.js' , included : true , watched : true } ,
13
- { pattern : 'node_modules/reflect-metadata/Reflect.js' , included : true , watched : true } ,
14
- { pattern : 'node_modules/systemjs/dist/system.src.js' , included : true , watched : true } ,
15
- { pattern : 'node_modules/rxjs/bundles/Rx.js' , included : true , watched : true } ,
16
- { pattern : 'node_modules/lodash/lodash.js' , included : true , watched : true } ,
17
- { pattern : 'karma-test-shim.js' , included : true , watched : true } ,
18
-
19
- // paths loaded via module imports
20
- { pattern : 'lib/**/*.js' , included : false , watched : true } ,
21
- { pattern : 'node_modules/@angular/**/*.js' , included : false , watched : true } ,
22
- { pattern : 'node_modules/rxjs/**/*.js' , included : false , watched : true } ,
23
- { pattern : 'node_modules/traceur/**/*.js' , included : false , watched : true } ,
24
-
25
- // paths to support debugging with source maps in dev tools
26
- { pattern : 'src/**/*.ts' , included : false , watched : false } ,
27
- { pattern : 'lib/**/*.js.map' , included : false , watched : false }
28
- ] ,
29
-
30
- // proxied base paths
31
- proxies : {
32
- // required for component assests fetched by Angular's compiler
33
- '/src/' : '/base/src/'
34
- } ,
35
-
36
- port : 9876 ,
37
-
38
- logLevel : config . LOG_INFO ,
39
-
40
- colors : true ,
41
-
42
- autoWatch : true ,
43
-
44
- browsers : [ 'Chrome' ] ,
45
-
46
13
// Karma plugins loaded
47
14
plugins : [
48
15
'karma-jasmine' ,
@@ -51,21 +18,140 @@ module.exports = function(config) {
51
18
'karma-phantomjs-launcher'
52
19
] ,
53
20
54
- // Coverage reporter generates the coverage
55
- reporters : [ 'progress' , 'dots' , 'coverage' ] ,
21
+ customLaunchers : {
22
+ // From the CLI. Not used here but interesting
23
+ // chrome setup for travis CI using chromium
24
+ Chrome_travis_ci : {
25
+ base : 'Chrome' ,
26
+ flags : [ '--no-sandbox' ]
27
+ }
28
+ } ,
29
+
30
+ files : [
31
+ // System.js for module loading
32
+ 'node_modules/systemjs/dist/system.src.js' ,
33
+
34
+ // Polyfills
35
+ 'node_modules/core-js/client/shim.js' ,
36
+
37
+ // Zone.js
38
+ 'node_modules/zone.js/dist/zone.js' ,
39
+ 'node_modules/zone.js/dist/long-stack-trace-zone.js' ,
40
+ 'node_modules/zone.js/dist/proxy.js' ,
41
+ 'node_modules/zone.js/dist/sync-test.js' ,
42
+ 'node_modules/zone.js/dist/jasmine-patch.js' ,
43
+ 'node_modules/zone.js/dist/async-test.js' ,
44
+ 'node_modules/zone.js/dist/fake-async-test.js' ,
45
+
46
+ // RxJs
47
+ {
48
+ pattern : 'node_modules/rxjs/**/*.js' ,
49
+ included : false ,
50
+ watched : false
51
+ } ,
52
+ {
53
+ pattern : 'node_modules/rxjs/**/*.js.map' ,
54
+ included : false ,
55
+ watched : false
56
+ } ,
57
+
58
+ // Angular 2
59
+ {
60
+ pattern : 'node_modules/@angular/**/*.js' ,
61
+ included : false ,
62
+ watched : false
63
+ } ,
64
+ {
65
+ pattern : 'node_modules/@angular/**/*.js.map' ,
66
+ included : false ,
67
+ watched : false
68
+ } ,
69
+
70
+ // Lodash
71
+ {
72
+ pattern : 'node_modules/lodash/lodash.js' ,
73
+ included : false ,
74
+ watched : false
75
+ } ,
76
+
77
+ // The testing library
78
+ {
79
+ pattern : 'systemjs.config.js' ,
80
+ included : false ,
81
+ watched : false
82
+ } ,
83
+ 'karma-test-shim.js' ,
84
+
85
+ // transpiled application & spec code paths loaded via module imports
86
+ {
87
+ pattern : appBase + '**/*.js' ,
88
+ included : false ,
89
+ watched : true
90
+ } ,
91
+
92
+ // asset (HTML & CSS) paths loaded via Angular's component compiler
93
+ // (these paths need to be rewritten, see proxies section)
94
+ {
95
+ pattern : appBase + '**/*.html' ,
96
+ included : false ,
97
+ watched : true
98
+ } ,
99
+ {
100
+ pattern : appBase + '**/*.css' ,
101
+ included : false ,
102
+ watched : true
103
+ } ,
104
+
105
+ // paths for debugging with source maps in dev tools
106
+ {
107
+ pattern : appSrcBase + '**/*.ts' ,
108
+ included : false ,
109
+ watched : false
110
+ } ,
111
+ {
112
+ pattern : appBase + '**/*.js.map' ,
113
+ included : false ,
114
+ watched : false
115
+ }
116
+ ] ,
117
+
118
+ // proxied base paths for loading assets
119
+ proxies : {
120
+ // required for component assets fetched by Angular's compiler
121
+ "/lib/" : appAssets
122
+ } ,
123
+
124
+ exclude : [ ] ,
56
125
57
126
// Source files that you wanna generate coverage for.
58
127
// Do not include tests or libraries (these files will be instrumented by Istanbul)
59
128
preprocessors : {
60
129
'lib/**/!(*spec).js' : [ 'coverage' ]
61
130
} ,
62
131
132
+ // Coverage reporter generates the coverage
133
+ reporters : [ 'progress' , 'dots' , 'coverage' ] ,
134
+
63
135
coverageReporter : {
64
- reporters :[
65
- { type : 'json' , subdir : '.' , file : 'coverage-final.json' }
136
+ reporters : [
137
+ {
138
+ type : 'json' ,
139
+ subdir : '.' ,
140
+ file : 'coverage-final.json'
141
+ }
66
142
]
67
143
} ,
68
144
145
+ port : 9876 ,
146
+
147
+ colors : true ,
148
+
149
+ logLevel : config . LOG_INFO ,
150
+
151
+ autoWatch : true ,
152
+
153
+ browsers : [ 'Chrome' ] ,
154
+
69
155
singleRun : true
70
156
} )
71
157
} ;
0 commit comments