test(lsp): use named tmpdir import to avoid node:os 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 4e763fb0cb
commit 63170f4dd8
3 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
import { describe, expect, it } from "bun:test"
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs"
import { tmpdir } from "os"
import { join } from "path"
import os from "os"
import { findWorkspaceRoot } from "./lsp-client-wrapper"
describe("lsp utils", () => {
describe("findWorkspaceRoot", () => {
it("returns an existing directory even when the file path points to a non-existent nested path", () => {
const tmp = mkdtempSync(join(os.tmpdir(), "omo-lsp-root-"))
const tmp = mkdtempSync(join(tmpdir(), "omo-lsp-root-"))
try {
// Add a marker so the function can discover the workspace root.
writeFileSync(join(tmp, "package.json"), "{}")
@@ -23,7 +23,7 @@ describe("lsp utils", () => {
})
it("prefers the nearest marker directory when markers exist above the file", () => {
const tmp = mkdtempSync(join(os.tmpdir(), "omo-lsp-marker-"))
const tmp = mkdtempSync(join(tmpdir(), "omo-lsp-marker-"))
try {
const repo = join(tmp, "repo")
const src = join(repo, "src")