(service: string, label = "e2e")
| 6 | // also keeps ledger assertions free of cross-run pollution. The server |
| 7 | // generates an unguessable instance name; the label is a readable prefix. |
| 8 | export const createEmulatorInstance = (service: string, label = "e2e") => |
| 9 | Effect.promise(async () => { |
| 10 | const response = await fetch(`https://${service}.emulators.dev/_emulate/instances`, { |
| 11 | method: "POST", |
| 12 | headers: { "content-type": "application/json" }, |
| 13 | body: JSON.stringify({ instance: label }), |
| 14 | }); |
| 15 | if (!response.ok) { |
| 16 | throw new Error(`${service} emulator instance creation failed: ${response.status}`); |
| 17 | } |
| 18 | const instance = (await response.json()) as { readonly providerBaseUrl: string }; |
| 19 | return instance.providerBaseUrl; |
| 20 | }); |
no test coverage detected