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