(cwd: string, args: readonly string[], stdin?: string)
| 6 | const fixtureDir = dirname(fileURLToPath(import.meta.url)); |
| 7 | |
| 8 | const run = (cwd: string, args: readonly string[], stdin?: string): string => { |
| 9 | const proc = Bun.spawnSync({ |
| 10 | cmd: ["git", ...args], |
| 11 | cwd, |
| 12 | stdin: stdin ? new TextEncoder().encode(stdin) : undefined, |
| 13 | }); |
| 14 | if (!proc.success) { |
| 15 | throw new Error( |
| 16 | `git ${args.join(" ")} failed\n${proc.stderr.toString()}\n${proc.stdout.toString()}`, |
| 17 | ); |
| 18 | } |
| 19 | return proc.stdout.toString().trim(); |
| 20 | }; |
| 21 | |
| 22 | const write = async (root: string, path: string, body: string) => { |
| 23 | await mkdir(dirname(join(root, path)), { recursive: true }); |
no test coverage detected