@@ -181,6 +181,14 @@ module.exports = function(grunt) {
181
181
'tests/**/*.js'
182
182
]
183
183
}
184
+ } ,
185
+ test_rhino : {
186
+ tests : {
187
+ src : [
188
+ '<%= concat.tests.dest %>' ,
189
+ 'tests/all-rules.js'
190
+ ]
191
+ }
184
192
}
185
193
} ) ;
186
194
@@ -195,7 +203,9 @@ module.exports = function(grunt) {
195
203
// Default task.
196
204
grunt . registerTask ( 'default' , [ 'test' ] ) ;
197
205
206
+ //Testing
198
207
grunt . registerTask ( 'test' , [ 'clean:build' , 'jshint' , 'concat' , 'yuitest' ] ) ;
208
+ grunt . registerTask ( 'rhino' , [ 'clean:build' , 'jshint' , 'concat' , 'test_rhino' ] ) ;
199
209
200
210
grunt . registerTask ( 'release' , [ 'test' , 'clean:release' , 'copy:release' , 'includereplace:release' , 'changelog' ] ) ;
201
211
@@ -232,18 +242,11 @@ module.exports = function(grunt) {
232
242
233
243
//Event to execute after all tests suites are finished
234
244
function reportResults ( allsuites ) {
235
- var end = Date . now ( ) ;
236
- var elapsed = end - start ;
237
- grunt . log . writeln ( ) . write ( "Finished in " + ( elapsed / 1000 ) + " seconds" ) . writeln ( ) ;
238
-
239
- if ( allsuites . results . failed > 0 ) {
240
- grunt . fail . warn ( allsuites . results . failed + "/" + allsuites . results . total + "tests failed" ) ;
241
- } else {
242
- grunt . log . ok ( allsuites . results . passed + "/" + allsuites . results . total + "tests passed" ) ;
243
- if ( allsuites . results . ignored > 0 ) {
244
- grunt . log . warn ( "Ignored: " + allsuites . results . ignored ) ;
245
- }
246
- }
245
+ var results = allsuites . results ;
246
+ grunt . log . write ( "\nTotal tests: " + results . total + ", Failures: " +
247
+ results . failed + ", Skipped: " + results . ignored +
248
+ ", Time: " + ( results . duration / 1000 ) + " seconds\n" ) ;
249
+
247
250
//Tell grunt we're done the async testing
248
251
done ( ) ;
249
252
}
@@ -323,4 +326,24 @@ module.exports = function(grunt) {
323
326
} ) ;
324
327
325
328
} ) ;
329
+
330
+ //Run test suite through rhino
331
+ grunt . registerMultiTask ( 'test_rhino' , 'Run the test suite through rhino' , function ( ) {
332
+ var done = this . async ( ) ;
333
+ var files = this . filesSrc ;
334
+ var progress = files . length ;
335
+
336
+ files . forEach ( function ( filepath ) {
337
+ grunt . util . spawn ( {
338
+ cmd : 'java' ,
339
+ args : [ '-jar' , 'lib/js.jar' , 'lib/yuitest-rhino-cli.js' , 'build/csslint.js' , filepath ] ,
340
+ opts : { stdio : 'inherit' }
341
+ } , function ( error , result , code ) {
342
+ progress -- ;
343
+ if ( progress === 0 ) {
344
+ done ( ) ;
345
+ }
346
+ } ) ;
347
+ } ) ;
348
+ } ) ;
326
349
} ;
0 commit comments