@@ -9,18 +9,8 @@ var gulp = require('gulp'),
9
9
childProcess = require ( 'child_process' ) ;
10
10
11
11
var yargs = require ( '../util/yargs' ) ,
12
- streams = require ( '../config/streams' ) ,
13
12
platform = require ( '../config/platform' ) ;
14
13
15
- /**
16
- * Wrap the given value in quotation marks
17
- * @param {* } value The value to wrap
18
- * @returns {string } The string representation of the value in quotation marks
19
- */
20
- function quote ( value ) {
21
- return '"' + value + '"' ;
22
- }
23
-
24
14
var defaultReporterName = 'karma-angularity-reporter' ;
25
15
26
16
var filesAppendRegex = / \/ \* + \s * A N G U L A R I T Y _ F I L E _ L I S T \s * \* + \/ / ;
@@ -95,7 +85,7 @@ function getKarmaReporterName(reporterName) {
95
85
if ( ! ! match && match . length === 2 ) {
96
86
name = match [ 1 ] ;
97
87
}
98
- return name
88
+ return name ;
99
89
}
100
90
101
91
/**
@@ -118,25 +108,33 @@ function karmaCreateConfig(reporters, configFileName) {
118
108
configFileName = configFileName || 'karma.conf.js' ;
119
109
var files = [ ] ;
120
110
111
+ files . push ( '**/!(app|app-build|app-release|app-test)/*.js' ) ;
112
+
113
+ files . push ( {
114
+ 'pattern' : '**/*.map' ,
115
+ 'included' : false
116
+ } ) ;
117
+
118
+ files . push ( {
119
+ 'pattern' : '**/*.spec.js' ,
120
+ 'included' : false
121
+ } ) ;
122
+
123
+ // add the bundles
121
124
function transformFn ( file , encoding , transformDone ) {
122
125
if ( ! file || ! file . path ) {
123
126
throw 'Files must have paths' ;
124
127
}
125
128
if ( path . extname ( file . path ) === '.js' ) {
126
129
files . push ( file . path ) ;
127
130
}
128
- else {
129
- //non-javascript files, such as source maps, should be included but not tested
130
- files . push ( {
131
- pattern : file . path ,
132
- included : false ,
133
- } ) ;
134
- }
135
131
transformDone ( ) ;
136
132
}
137
133
138
134
function flushFn ( flushDone ) {
135
+ /*jshint validthis:true */
139
136
var stream = this ;
137
+ constructFile ( ) ;
140
138
141
139
function constructFile ( ) {
142
140
var filesAppend = JSON . stringify ( files , null , ' ' ) ;
@@ -160,28 +158,7 @@ function karmaCreateConfig(reporters, configFileName) {
160
158
. on ( 'end' , function ( ) {
161
159
flushDone ( ) ;
162
160
} ) ;
163
- }
164
-
165
- function specTransformFn ( file , encoding , specFileDone ) {
166
- files . push ( {
167
- pattern : file . path ,
168
- included : false ,
169
- } ) ;
170
- specFileDone ( ) ;
171
- }
172
-
173
- function specFlushFn ( specFlushDone ) {
174
- //delay construction of file until all *.spec.js files have been
175
- //added to the files array
176
- constructFile ( ) ;
177
- specFlushDone ( ) ;
178
161
}
179
-
180
- //obtain a list of *.spec.js files (file contents skipped)
181
- //and add them to the list of files, with `included: false`,
182
- //prior to writing to file
183
- streams . jsSpec ( { read : false } )
184
- . pipe ( through . obj ( specTransformFn , specFlushFn ) ) ;
185
162
}
186
163
187
164
return through . obj ( transformFn , flushFn ) ;
@@ -193,10 +170,9 @@ function karmaCreateConfig(reporters, configFileName) {
193
170
* Runs karma in a child process, to avoid `process.exit()` called by karma.
194
171
*
195
172
* @param {Array.<string> } [reporters] The name of the karma reporter to use
196
- * @param {number } [bannerWidth] The width of banner comment, zero or omitted for none
197
173
* @returns {stream.Through } A through stream intended to have a gulp stream piped through it
198
174
*/
199
- function karmaRun ( reporters , bannerWidth ) {
175
+ function karmaRun ( reporters ) {
200
176
var options = {
201
177
configFile : undefined
202
178
} ;
@@ -222,12 +198,12 @@ function karmaRun(reporters, bannerWidth) {
222
198
SUPPORTS_COLOR : true ,
223
199
} ) ,
224
200
} ) ;
225
- karmaBackground . on ( 'close' , function ( exitCode ) {
201
+ karmaBackground . on ( 'close' , function ( ) {
226
202
done ( ) ;
227
203
return ;
228
204
} ) ;
229
205
} ) ;
230
- } ;
206
+ }
231
207
232
208
var yargsOptionDefiniton = {
233
209
key : 'karmareporter' ,
0 commit comments