@@ -4,14 +4,11 @@ import Future = require("fibers/future");
4
4
import { assert } from "chai" ;
5
5
import { DevicePlatformsConstants } from "../../../mobile/device-platforms-constants" ;
6
6
7
- let currentlyRunningSimulator : any ,
8
- isCurrentlyRunning : boolean ;
7
+ let currentlyRunningSimulator : any ;
9
8
10
9
function createTestInjector ( ) : IInjector {
11
10
let injector = new Yok ( ) ;
12
- injector . register ( "childProcess" , {
13
- exec : ( command : string ) => Future . fromResult ( isCurrentlyRunning ? 'launchd_sim' : '' )
14
- } ) ;
11
+ injector . register ( "childProcess" , { /* No implementation required. */ } ) ;
15
12
injector . register ( "injector" , injector ) ;
16
13
injector . register ( "iOSSimResolver" , {
17
14
iOSSim : {
@@ -24,12 +21,6 @@ function createTestInjector(): IInjector {
24
21
25
22
injector . register ( "devicePlatformsConstants" , DevicePlatformsConstants ) ;
26
23
27
- injector . register ( "iOSSimResolver" , {
28
- iOSSim : {
29
- getRunningSimulator : ( ) => currentlyRunningSimulator
30
- }
31
- } ) ;
32
-
33
24
injector . register ( "iOSSimulatorDiscovery" , IOSSimulatorDiscovery ) ;
34
25
return injector ;
35
26
}
@@ -42,7 +33,6 @@ describe("ios-simulator-discovery", () => {
42
33
43
34
let detectNewSimulatorAttached = ( runningSimulator : any ) : Mobile . IiOSSimulator => {
44
35
let future = new Future < any > ( ) ;
45
- isCurrentlyRunning = true ;
46
36
currentlyRunningSimulator = _ . cloneDeep ( runningSimulator ) ;
47
37
iOSSimulatorDiscovery . once ( "deviceFound" , ( device : Mobile . IDevice ) => {
48
38
future . return ( device ) ;
@@ -52,7 +42,7 @@ describe("ios-simulator-discovery", () => {
52
42
} ;
53
43
54
44
let detectSimulatorDetached = ( ) : Mobile . IiOSSimulator => {
55
- isCurrentlyRunning = false ;
45
+ currentlyRunningSimulator = null ;
56
46
let lostDeviceFuture = new Future < Mobile . IDevice > ( ) ;
57
47
iOSSimulatorDiscovery . once ( "deviceLost" , ( device : Mobile . IDevice ) => {
58
48
lostDeviceFuture . return ( device ) ;
@@ -62,7 +52,6 @@ describe("ios-simulator-discovery", () => {
62
52
} ;
63
53
64
54
let detectSimulatorChanged = ( newId : string ) : any => {
65
- isCurrentlyRunning = true ;
66
55
currentlyRunningSimulator . id = newId ;
67
56
let lostDeviceFuture = new Future < Mobile . IDevice > ( ) ,
68
57
foundDeviceFuture = new Future < Mobile . IDevice > ( ) ;
@@ -83,11 +72,11 @@ describe("ios-simulator-discovery", () => {
83
72
} ;
84
73
85
74
beforeEach ( ( ) => {
86
- isCurrentlyRunning = false ;
87
75
currentlyRunningSimulator = null ;
88
76
testInjector = createTestInjector ( ) ;
89
77
iOSSimulatorDiscovery = testInjector . resolve ( "iOSSimulatorDiscovery" ) ;
90
- expectedDeviceInfo = { identifier : "id" ,
78
+ expectedDeviceInfo = {
79
+ identifier : "id" ,
91
80
displayName : 'name' ,
92
81
model : 'c' ,
93
82
version : '9.2.1' ,
@@ -156,7 +145,6 @@ describe("ios-simulator-discovery", () => {
156
145
throw new Error ( "Cannot find iOS Devices." ) ;
157
146
} ) . future < any > ( ) ( ) ;
158
147
} ;
159
- isCurrentlyRunning = true ;
160
148
iOSSimulatorDiscovery . on ( "deviceFound" , ( device : Mobile . IDevice ) => {
161
149
throw new Error ( "Device found should not be raised when getting running iOS Simulator fails." ) ;
162
150
} ) ;
@@ -165,7 +153,6 @@ describe("ios-simulator-discovery", () => {
165
153
166
154
it ( "does not detect iOS Simulator when not running on OS X" , ( ) => {
167
155
testInjector . resolve ( "hostInfo" ) . isDarwin = false ;
168
- isCurrentlyRunning = true ;
169
156
iOSSimulatorDiscovery . on ( "deviceFound" , ( device : Mobile . IDevice ) => {
170
157
throw new Error ( "Device found should not be raised when OS is not OS X." ) ;
171
158
} ) ;
@@ -174,7 +161,6 @@ describe("ios-simulator-discovery", () => {
174
161
175
162
it ( "checkForDevices return future" , ( ) => {
176
163
testInjector . resolve ( "hostInfo" ) . isDarwin = false ;
177
- isCurrentlyRunning = true ;
178
164
iOSSimulatorDiscovery . on ( "deviceFound" , ( device : Mobile . IDevice ) => {
179
165
throw new Error ( "Device found should not be raised when OS is not OS X." ) ;
180
166
} ) ;
0 commit comments