From 4e763fb0cb69be87fbd2d694e322d847a5e3149f Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 4 May 2026 16:30:23 +0900 Subject: [PATCH] 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 --- src/features/team-mode/team-worktree/cleanup.test.ts | 4 ++-- src/features/team-mode/team-worktree/manager.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/team-mode/team-worktree/cleanup.test.ts b/src/features/team-mode/team-worktree/cleanup.test.ts index f47c63af9..f9b1c711d 100644 --- a/src/features/team-mode/team-worktree/cleanup.test.ts +++ b/src/features/team-mode/team-worktree/cleanup.test.ts @@ -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 }) diff --git a/src/features/team-mode/team-worktree/manager.test.ts b/src/features/team-mode/team-worktree/manager.test.ts index b1e98556b..a133d179b 100644 --- a/src/features/team-mode/team-worktree/manager.test.ts +++ b/src/features/team-mode/team-worktree/manager.test.ts @@ -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 { - 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")