(
command: string,
args: Array<string>,
options: {
cwd?: string
env?: NodeJS.ProcessEnv
} = {},
)
| 27 | const resultsDatabaseName = `tanstack_db_capacitor_e2e_results_${runtimeRunId}` |
| 28 | |
| 29 | function runCommand( |
| 30 | command: string, |
| 31 | args: Array<string>, |
| 32 | options: { |
| 33 | cwd?: string |
| 34 | env?: NodeJS.ProcessEnv |
| 35 | } = {}, |
| 36 | ): Promise<void> { |
| 37 | return new Promise((resolvePromise, rejectPromise) => { |
| 38 | const child = spawn(command, args, { |
| 39 | cwd: options.cwd ?? packageDirectory, |
| 40 | env: { |
| 41 | ...process.env, |
| 42 | ...options.env, |
| 43 | }, |
| 44 | stdio: `inherit`, |
| 45 | }) |
| 46 | |
| 47 | child.on(`exit`, (code) => { |
| 48 | if (code === 0) { |
| 49 | resolvePromise() |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | rejectPromise( |
| 54 | new Error( |
| 55 | `${command} ${args.join(` `)} exited with code ${String(code)}`, |
| 56 | ), |
| 57 | ) |
| 58 | }) |
| 59 | child.on(`error`, rejectPromise) |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | async function resolveSimulatorId(): Promise<string> { |
| 64 | const requestedId = process.env.TANSTACK_DB_CAPACITOR_IOS_SIMULATOR_ID?.trim() |
no test coverage detected