mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
test: ensure snapshot tests run reliably by preventing shared shadow repo state across parallel test execution
This commit is contained in:
parent
810255a851
commit
e1835cb221
1 changed files with 4 additions and 1 deletions
|
|
@ -10,7 +10,10 @@ type TmpDirOptions<T> = {
|
|||
export async function tmpdir<T>(options?: TmpDirOptions<T>) {
|
||||
const dirpath = path.join(os.tmpdir(), "opencode-test-" + Math.random().toString(36).slice(2))
|
||||
await $`mkdir -p ${dirpath}`.quiet()
|
||||
if (options?.git) await $`git init`.cwd(dirpath).quiet()
|
||||
if (options?.git) {
|
||||
await $`git init`.cwd(dirpath).quiet()
|
||||
await $`git commit --allow-empty -m "root commit ${dirpath}"`.cwd(dirpath).quiet()
|
||||
}
|
||||
const extra = await options?.init?.(dirpath)
|
||||
const result = {
|
||||
[Symbol.asyncDispose]: async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue