@@ -41,7 +41,11 @@ class TestExecutionService implements ITestExecutionService {
4141 try {
4242 let platformData = this . $platformsData . getPlatformData ( platform . toLowerCase ( ) , projectData ) ;
4343 let projectDir = projectData . projectDir ;
44- await this . $devicesService . initialize ( { platform : platform , deviceId : this . $options . device } ) ;
44+ await this . $devicesService . initialize ( {
45+ platform : platform ,
46+ deviceId : this . $options . device ,
47+ emulator : this . $options . emulator
48+ } ) ;
4549 await this . $devicesService . detectCurrentlyAttachedDevices ( ) ;
4650 let projectFilesPath = path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ;
4751
@@ -59,6 +63,7 @@ class TestExecutionService implements ITestExecutionService {
5963 if ( ! await this . $platformService . preparePlatform ( platform , appFilesUpdaterOptions , this . $options . platformTemplate , projectData , this . $options ) ) {
6064 this . $errors . failWithoutHelp ( "Verify that listed files are well-formed and try again the operation." ) ;
6165 }
66+
6267 this . detourEntryPoint ( projectFilesPath ) ;
6368
6469 const deployOptions : IDeployPlatformOptions = {
@@ -78,7 +83,8 @@ class TestExecutionService implements ITestExecutionService {
7883
7984 const devices = this . $devicesService . getDeviceInstances ( ) ;
8085 // Now let's take data for each device:
81- const deviceDescriptors : ILiveSyncDeviceInfo [ ] = devices . filter ( d => ! this . platform || d . deviceInfo . platform === this . platform )
86+ const platformLowerCase = this . platform && this . platform . toLowerCase ( ) ;
87+ const deviceDescriptors : ILiveSyncDeviceInfo [ ] = devices . filter ( d => ! platformLowerCase || d . deviceInfo . platform . toLowerCase ( ) === platformLowerCase )
8288 . map ( d => {
8389 const info : ILiveSyncDeviceInfo = {
8490 identifier : d . deviceInfo . identifier ,
@@ -99,19 +105,16 @@ class TestExecutionService implements ITestExecutionService {
99105
100106 await this . $platformService . buildPlatform ( d . deviceInfo . platform , buildConfig , projectData ) ;
101107 const pathToBuildResult = await this . $platformService . lastOutputPath ( d . deviceInfo . platform , buildConfig , projectData ) ;
102- console . log ( "3##### return path to buildResult = " , pathToBuildResult ) ;
103108 return pathToBuildResult ;
104109 }
105110 } ;
106111
107112 return info ;
108113 } ) ;
109114
110- // TODO: Fix this call
111115 const liveSyncInfo : ILiveSyncInfo = { projectDir : projectData . projectDir , skipWatcher : ! this . $options . watch || this . $options . justlaunch , watchAllFiles : this . $options . syncAllFiles } ;
116+
112117 await this . $liveSyncService . liveSync ( deviceDescriptors , liveSyncInfo ) ;
113- // TODO: Fix
114- // await this.$liveSyncService.liveSync(platform, projectData, null, this.$options);
115118
116119 if ( this . $options . debugBrk ) {
117120 this . $logger . info ( 'Starting debugger...' ) ;
@@ -142,7 +145,11 @@ class TestExecutionService implements ITestExecutionService {
142145 await this . $pluginsService . ensureAllDependenciesAreInstalled ( projectData ) ;
143146
144147 let projectDir = projectData . projectDir ;
145- await this . $devicesService . initialize ( { platform : platform , deviceId : this . $options . device } ) ;
148+ await this . $devicesService . initialize ( {
149+ platform : platform ,
150+ deviceId : this . $options . device ,
151+ emulator : this . $options . emulator
152+ } ) ;
146153
147154 let karmaConfig = this . getKarmaConfiguration ( platform , projectData ) ,
148155 karmaRunner = this . $childProcess . fork ( path . join ( __dirname , "karma-execution.js" ) ) ,
@@ -187,13 +194,14 @@ class TestExecutionService implements ITestExecutionService {
187194 } else {
188195 const devices = this . $devicesService . getDeviceInstances ( ) ;
189196 // Now let's take data for each device:
190- const deviceDescriptors : ILiveSyncDeviceInfo [ ] = devices . filter ( d => ! this . platform || d . deviceInfo . platform === this . platform )
197+ const platformLowerCase = this . platform && this . platform . toLowerCase ( ) ;
198+ const deviceDescriptors : ILiveSyncDeviceInfo [ ] = devices . filter ( d => ! platformLowerCase || d . deviceInfo . platform . toLowerCase ( ) === platformLowerCase )
191199 . map ( d => {
192200 const info : ILiveSyncDeviceInfo = {
193201 identifier : d . deviceInfo . identifier ,
194202 buildAction : async ( ) : Promise < string > => {
195203 const buildConfig : IBuildConfig = {
196- buildForDevice : ! d . isEmulator , // this.$options.forDevice,
204+ buildForDevice : ! d . isEmulator ,
197205 projectDir : this . $options . path ,
198206 clean : this . $options . clean ,
199207 teamId : this . $options . teamId ,
@@ -208,15 +216,13 @@ class TestExecutionService implements ITestExecutionService {
208216
209217 await this . $platformService . buildPlatform ( d . deviceInfo . platform , buildConfig , projectData ) ;
210218 const pathToBuildResult = await this . $platformService . lastOutputPath ( d . deviceInfo . platform , buildConfig , projectData ) ;
211- console . log ( "3##### return path to buildResult = " , pathToBuildResult ) ;
212219 return pathToBuildResult ;
213220 }
214221 } ;
215222
216223 return info ;
217224 } ) ;
218225
219- // TODO: Fix this call
220226 const liveSyncInfo : ILiveSyncInfo = { projectDir : projectData . projectDir , skipWatcher : ! this . $options . watch || this . $options . justlaunch , watchAllFiles : this . $options . syncAllFiles } ;
221227 await this . $liveSyncService . liveSync ( deviceDescriptors , liveSyncInfo ) ;
222228 }
0 commit comments