MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / main

Function main

scripts/integration/js-api.mjs:55–345  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 });
54
55async 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),

Callers 1

js-api.mjsFile · 0.70

Calls 15

connectFunction · 0.90
expectFixtureTextFunction · 0.85
closeSessionFunction · 0.85
eraseSimulatorReliablyFunction · 0.85
logMethod · 0.80
bootMethod · 0.80
recordMethod · 0.80
measuredStepFunction · 0.70
runTextFunction · 0.70
retryAsyncFunction · 0.70
openSimulatorAppFunction · 0.70

Tested by

no test coverage detected