@@ -22,7 +22,12 @@ function UnitTestFramework(testConfig, _logger)
2222 var unitTestConfig = require ( configFile ) ;
2323
2424 UnitTestFramework . super_ . call ( this , testConfig , unitTestConfig , _logger ) ;
25- this . runningTests = [ ] ;
25+
26+ // Track which platforms we expect to be running on
27+ var self = this ;
28+ self . runningTests = Object . keys ( self . requiredDevices ) . filter ( function ( platform ) {
29+ return self . requiredDevices [ platform ] ;
30+ } ) ;
2631}
2732
2833util . inherits ( UnitTestFramework , TestFramework ) ;
@@ -46,7 +51,7 @@ UnitTestFramework.prototype.startTests = function(platform, tests) {
4651 var self = this ;
4752 function doTest ( test , cb ) {
4853
49- logger . info ( "Running test: " + test ) ;
54+ logger . info ( "Running on %s test: %s" , platform , test ) ;
5055
5156 // Perform a single test
5257
@@ -89,8 +94,17 @@ UnitTestFramework.prototype.startTests = function(platform, tests) {
8994 }
9095 } ) ;
9196
92- // Start setup for this test
93- device . socket . emit ( "setup" , test ) ;
97+ if ( typeof jxcore !== 'undefined' && jxcore . utils . OSInfo ( ) . isMobile ) {
98+ // The timeout is added as a workaround for an issue
99+ // where the client hasn't necessarily had time
100+ // to add correct listeners on the socket
101+ setTimeout ( function ( ) {
102+ // Start setup for this test
103+ device . socket . emit ( "setup" , test ) ;
104+ } , 1000 ) ;
105+ } else {
106+ device . socket . emit ( "setup" , test ) ;
107+ }
94108 } ) ;
95109 }
96110
@@ -106,7 +120,7 @@ UnitTestFramework.prototype.startTests = function(platform, tests) {
106120
107121 // ALL DONE !!
108122 // All devices have completed all their tests
109- logger . info ( "Test run complete" ) ;
123+ logger . info ( "Test run on %s complete" , platform ) ;
110124
111125 // The whole point !! Log test results from the
112126 // server
@@ -117,7 +131,7 @@ UnitTestFramework.prototype.startTests = function(platform, tests) {
117131 device . socket . emit ( "complete" ) ;
118132 } ) ;
119133
120- // We're done runnign for this platform..
134+ // We're done running for this platform..
121135 self . runningTests = self . runningTests . filter ( function ( p ) {
122136 return ( p != platform ) ;
123137 } ) ;
@@ -130,7 +144,6 @@ UnitTestFramework.prototype.startTests = function(platform, tests) {
130144 }
131145
132146 toComplete = devices . length ;
133- this . runningTests . push ( platform ) ;
134147
135148 devices . forEach ( function ( device ) {
136149 // Wait for devices to signal they've scheduled their
0 commit comments