()
| 53 | }); |
| 54 | |
| 55 | async function main() { |
| 56 | if (process.platform !== "darwin") { |
| 57 | throw new Error("SimDeck JS API integration tests require macOS."); |
| 58 | } |
| 59 | if (!fs.existsSync(simdeck)) { |
| 60 | throw new Error(`Missing ${simdeck}. Run npm run build:cli first.`); |
| 61 | } |
| 62 | if ( |
| 63 | !fs.existsSync( |
| 64 | path.join(root, "packages", "simdeck-test", "dist", "index.js"), |
| 65 | ) |
| 66 | ) { |
| 67 | throw new Error( |
| 68 | "Missing simdeck/test dist. Run npm run build:simdeck-test first.", |
| 69 | ); |
| 70 | } |
| 71 | |
| 72 | const { runtime, deviceType, sdkVersion } = selectIntegrationSimulator({ |
| 73 | runJson, |
| 74 | runText, |
| 75 | timeoutMs: coreSimulatorCommandTimeoutMs, |
| 76 | }); |
| 77 | const simulatorName = `SimDeck JS API Integration ${Date.now()}`; |
| 78 | simulatorUDID = await measuredStep( |
| 79 | "simctl create simulator", |
| 80 | () => |
| 81 | runText("xcrun", [ |
| 82 | "simctl", |
| 83 | "create", |
| 84 | simulatorName, |
| 85 | deviceType.identifier, |
| 86 | runtime.identifier, |
| 87 | ]).trim(), |
| 88 | { phase: phaseSetup }, |
| 89 | ); |
| 90 | console.log( |
| 91 | `created ${simulatorUDID} (${deviceType.name}, ${runtime.version}; iphonesimulator SDK ${sdkVersion})`, |
| 92 | ); |
| 93 | |
| 94 | session = await measuredStep( |
| 95 | "simdeck/test isolated connect", |
| 96 | () => |
| 97 | connect({ |
| 98 | cliPath: simdeck, |
| 99 | projectRoot: root, |
| 100 | isolated: true, |
| 101 | videoCodec: "software", |
| 102 | udid: simulatorUDID, |
| 103 | }), |
| 104 | { phase: phaseSetup }, |
| 105 | ); |
| 106 | console.log(`service ${session.endpoint}`); |
| 107 | |
| 108 | await measuredStep( |
| 109 | "JS boot simulator", |
| 110 | () => |
| 111 | retryAsync( |
| 112 | () => session.boot(simulatorUDID), |
no test coverage detected