File tree Expand file tree Collapse file tree 4 files changed +47
-2
lines changed
Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import os
4+ import subprocess
5+
6+
7+ test = os .path .join (os .path .dirname (__file__ ), 'test.py' )
8+ subprocess .check_call ([test , '--ci' ])
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def main():
1717 else :
1818 atom_shell = os .path .join (SOURCE_ROOT , 'out' , 'Debug' , 'atom.exe' )
1919
20- subprocess .check_call ([atom_shell , 'spec' ])
20+ subprocess .check_call ([atom_shell , 'spec' ] + sys . argv [ 1 :] )
2121
2222
2323if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1515
1616 require ( 'coffee-script' ) ; // Supports .coffee tests.
1717
18+ // Rediret all output to browser.
19+ var ipc = require ( 'ipc' ) ;
20+ global . __defineGetter__ ( 'console' , function ( ) {
21+ return {
22+ log : function ( ) {
23+ args = Array . prototype . slice . call ( arguments ) ;
24+ ipc . sendChannel ( 'console.log' , args ) ;
25+ } ,
26+ error : function ( ) {
27+ args = Array . prototype . slice . call ( arguments ) ;
28+ ipc . sendChannel ( 'console.error' , args ) ;
29+ } ,
30+ }
31+ } ) ;
32+
1833 var Mocha = require ( 'mocha' ) ;
1934
2035 var mocha = new Mocha ( ) ;
2439 if ( query . grep ) mocha . grep ( query . grep ) ;
2540 if ( query . invert ) mocha . invert ( ) ;
2641
42+ // Check if we are running in CI.
43+ var argv = require ( 'remote' ) . process . argv ;
44+ var isCi = false ;
45+ if ( argv [ 1 ] == '--ci' ) {
46+ isCi = true ;
47+ mocha . reporter ( 'tap' ) ;
48+ }
49+
2750 // Read all test files.
2851 var walker = require ( 'walkdir' ) . walk ( __dirname ) ;
2952
3356 } ) ;
3457
3558 walker . on ( 'end' , function ( ) {
36- mocha . run ( function ( ) {
59+ var runner = mocha . run ( function ( ) {
3760 Mocha . utils . highlightTags ( 'code' ) ;
61+ if ( isCi )
62+ ipc . sendChannel ( 'process.exit' , runner . failures ) ;
3863 } ) ;
3964 } ) ;
4065} ) ( ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,18 @@ ipc.on('message', function() {
1010 ipc . send . apply ( this , arguments ) ;
1111} ) ;
1212
13+ ipc . on ( 'console.log' , function ( pid , rid , args ) {
14+ console . log . apply ( console , args ) ;
15+ } ) ;
16+
17+ ipc . on ( 'console.error' , function ( pid , rid , args ) {
18+ console . log . apply ( console , args ) ;
19+ } ) ;
20+
21+ ipc . on ( 'process.exit' , function ( pid , rid , code ) {
22+ process . exit ( code ) ;
23+ } ) ;
24+
1325process . on ( 'uncaughtException' , function ( ) {
1426 window . openDevTools ( ) ;
1527} ) ;
You can’t perform that action at this time.
0 commit comments