()
| 2206 | } |
| 2207 | |
| 2208 | function cleanup() { |
| 2209 | if (serverProcess && !serverProcess.killed) { |
| 2210 | serverProcess.kill("SIGTERM"); |
| 2211 | serverProcess = null; |
| 2212 | } |
| 2213 | killPortListeners(serverPort); |
| 2214 | if (simulatorUDID && !keepSimulator) { |
| 2215 | spawnSync("xcrun", ["simctl", "shutdown", simulatorUDID], { |
| 2216 | stdio: "ignore", |
| 2217 | }); |
| 2218 | spawnSync("xcrun", ["simctl", "delete", simulatorUDID], { |
| 2219 | stdio: "ignore", |
| 2220 | }); |
| 2221 | simulatorUDID = ""; |
| 2222 | } else if (simulatorUDID && keepSimulator) { |
| 2223 | console.log(`Keeping integration simulator ${simulatorUDID}`); |
| 2224 | simulatorUDID = ""; |
| 2225 | } |
| 2226 | if (fs.existsSync(tempRoot)) { |
| 2227 | fs.rmSync(tempRoot, { recursive: true, force: true }); |
| 2228 | } |
| 2229 | } |
| 2230 | |
| 2231 | function killPortListeners(port) { |
| 2232 | const result = spawnSync( |
no test coverage detected