test: fix CI test isolation - upgrade Bun, fix mock contamination and fresh-import patterns

This commit is contained in:
YeonGyu-Kim
2026-04-05 01:01:19 +09:00
parent aa7e2aa07f
commit da86b57f23
7 changed files with 69 additions and 51 deletions
@@ -8,7 +8,9 @@ import type { Tool as McpTool } from "@modelcontextprotocol/sdk/types.js"
const originalReadFileSync = fs.readFileSync.bind(fs)
async function importFreshSkillToolModule(): Promise<typeof import("./tools")> {
let createSkillTool: typeof import("../tools").createSkillTool
beforeEach(async () => {
mock.module("node:fs", () => ({
...fs,
readFileSync: (path: string, encoding?: string) => {
@@ -21,13 +23,10 @@ Test skill body content`
return originalReadFileSync(path, encoding as BufferEncoding)
},
}))
const module = await import(`./tools?test=${Date.now()}-${Math.random()}`)
mock.restore()
return module
}
const { createSkillTool } = await importFreshSkillToolModule()
const module = await import("../tools")
createSkillTool = module.createSkillTool
})
afterAll(() => {
mock.restore()