fix(ci): simplify test runner to plain bun test by fixing mock.module() leakage
- Add afterAll(() => { mock.restore() }) to 52 test files missing cleanup
- Rewrite create-tool-guard-hooks.test.ts to use spyOn instead of barrel mock
- Fix skill-mcp-manager OAuth tests with missing mockTokens/mockLogin definitions
- Fix start-work hook: show worktree active block on resume with existing worktree_path
- Extract createWorktreeActiveBlock to worktree-block.ts to avoid circular import
- Replace 80-line isolated test runner CI config with single `bun test` command
This commit is contained in:
+5
-1
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, mock, beforeEach } from "bun:test"
|
||||
import { afterAll, describe, it, expect, mock, beforeEach } from "bun:test"
|
||||
import { fixEmptyMessagesWithSDK } from "./empty-content-recovery-sdk"
|
||||
|
||||
const mockReplaceEmptyTextParts = mock(() => Promise.resolve(false))
|
||||
@@ -11,6 +11,10 @@ mock.module("../session-recovery/storage/text-part-injector", () => ({
|
||||
injectTextPartAsync: mockInjectTextPart,
|
||||
}))
|
||||
|
||||
afterAll(() => {
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
function createMockClient(messages: Array<{ info?: { id?: string }; parts?: Array<{ type?: string; text?: string }> }>) {
|
||||
return {
|
||||
session: {
|
||||
|
||||
@@ -11,6 +11,7 @@ mock.module("./deduplication-recovery", () => ({
|
||||
|
||||
afterAll(() => {
|
||||
mock.module("./deduplication-recovery", () => originalDeduplicationRecovery)
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
function createImmediateTimeouts(): () => void {
|
||||
|
||||
@@ -13,6 +13,7 @@ mock.module("./storage", () => {
|
||||
|
||||
afterAll(() => {
|
||||
mock.module("./storage", () => storage)
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
describe("truncateUntilTargetTokens", () => {
|
||||
|
||||
Reference in New Issue
Block a user