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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user