File tree 1 file changed +30
-1
lines changed
1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -384,7 +384,36 @@ function runSuites(suites, callback) {
384
384
function importSuites ( files ) {
385
385
msg ( options . watcher ? 'watcher' : 'runner' , 'loading' , files ) ;
386
386
387
- return files . reduce ( function ( suites , f ) {
387
+ var exec = require ( 'child_process' ) . exec ;
388
+
389
+ function wrapExec ( f ) {
390
+ return function ( options , callback ) {
391
+ var cmd = process . argv . slice ( 0 , 2 ) . concat ( '--json' ) ;
392
+
393
+ exec ( cmd . join ( ' ' ) , function ( err , stdout , stderr ) {
394
+ if ( err ) {
395
+ reporter . report ( [ 'error' , stderr ] ) ;
396
+ callback ( {
397
+ errored : 1 ,
398
+ total : 1
399
+ } ) ;
400
+ return ;
401
+ }
402
+
403
+ var result = stdout . split ( / \n / g) . map ( function ( i ) {
404
+ if ( i ) {
405
+ reporter . report ( JSON . parse ( i ) ) ;
406
+ }
407
+ } ) ;
408
+ } )
409
+ }
410
+ }
411
+
412
+ return files . reduce ( options . isolate ? function ( suites , f ) {
413
+ return suites . concat ( {
414
+ run : wrapExec ( f )
415
+ } ) ;
416
+ } : function ( suites , f ) {
388
417
var obj = require ( f ) ;
389
418
return suites . concat ( Object . keys ( obj ) . map ( function ( s ) {
390
419
obj [ s ] . _filename = f . replace ( process . cwd ( ) + '/' , '' ) + '.js' ;
You can’t perform that action at this time.
0 commit comments