test(team-mode/team-worktree): use named tmpdir import to avoid mock leak

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-04 16:30:23 +09:00
parent 700ba1e541
commit 4e763fb0cb
2 changed files with 4 additions and 4 deletions
@@ -2,7 +2,7 @@
import { afterAll, expect, test } from "bun:test"
import fs from "node:fs/promises"
import os from "node:os"
import { tmpdir } from "node:os"
import path from "node:path"
import { findOrphanWorktrees } from "./cleanup"
@@ -17,7 +17,7 @@ afterAll(async () => {
test("given runtime mismatch when findOrphanWorktrees then returns orphan paths", async () => {
// given
const baseDir = await fs.mkdtemp(path.join(os.tmpdir(), "team-worktree-orphans-"))
const baseDir = await fs.mkdtemp(path.join(tmpdir(), "team-worktree-orphans-"))
temporaryDirectories.push(baseDir)
await fs.mkdir(path.join(baseDir, "worktrees", "t1", "m1"), { recursive: true })
await fs.mkdir(path.join(baseDir, "runtime", "t1"), { recursive: true })
@@ -3,7 +3,7 @@
import { afterAll, beforeAll, describe, expect, mock, test } from "bun:test"
import { randomUUID } from "node:crypto"
import fs from "node:fs/promises"
import os from "node:os"
import { tmpdir } from "node:os"
import path from "node:path"
import { GitUnavailableError, createWorktree, setGitCommandRunnerForTests, validateWorktreeSpec } from "./manager"
@@ -12,7 +12,7 @@ import { removeWorktree } from "./cleanup"
const temporaryDirectories: string[] = []
async function initGitRepo(): Promise<string> {
const repositoryRoot = await fs.mkdtemp(path.join(os.tmpdir(), "team-worktree-"))
const repositoryRoot = await fs.mkdtemp(path.join(tmpdir(), "team-worktree-"))
temporaryDirectories.push(repositoryRoot)
Bun.spawnSync(["git", "init"], { cwd: repositoryRoot, stdout: "pipe", stderr: "pipe" })
await fs.writeFile(path.join(repositoryRoot, "README.md"), "hello\n")