File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,11 @@ class Cmd {
139139 . command ( 'test' )
140140 . description ( 'run tests' )
141141 . action ( function ( ) {
142- shelljs . exec ( 'mocha test' ) ;
142+ embark . initConfig ( 'development' , {
143+ embarkConfig : 'embark.json' , interceptLogs : false
144+ } ) ;
145+ embark . runTests ( ) ;
146+ //shelljs.exec('mocha test');
143147 } ) ;
144148 }
145149
Original file line number Diff line number Diff line change @@ -195,6 +195,34 @@ class Embark {
195195 }
196196 }
197197
198+ runTests ( ) {
199+ var Mocha = require ( 'mocha' ) ,
200+ fs = require ( 'fs' ) ,
201+ path = require ( 'path' ) ;
202+
203+ var mocha = new Mocha ( ) ;
204+
205+ var testDir = 'test/' ;
206+
207+ // Add each .js file to the mocha instance
208+ fs . readdirSync ( testDir ) . filter ( function ( file ) {
209+ // Only keep the .js files
210+ return file . substr ( - 3 ) === '.js' ;
211+
212+ } ) . forEach ( function ( file ) {
213+ mocha . addFile (
214+ path . join ( testDir , file )
215+ ) ;
216+ } ) ;
217+
218+ // Run the tests.
219+ mocha . run ( function ( failures ) {
220+ process . on ( 'exit' , function ( ) {
221+ process . exit ( failures ) ; // exit with non-zero status if there were failures
222+ } ) ;
223+ } ) ;
224+ }
225+
198226}
199227
200228// temporary until next refactor
Original file line number Diff line number Diff line change 2626 "fs-extra" : " ^2.0.0" ,
2727 "globule" : " ^1.1.0" ,
2828 "merge" : " ^1.2.0" ,
29+ "mocha" : " ^2.2.5" ,
2930 "promptly" : " ^2.1.0" ,
3031 "serve-static" : " ^1.11.1" ,
3132 "shelljs" : " ^0.5.0" ,
You can’t perform that action at this time.
0 commit comments