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:
@@ -1,6 +1,6 @@
|
||||
/// <reference path="../../bun-test.d.ts" />
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test"
|
||||
import { afterAll, afterEach, beforeEach, describe, expect, it, mock } from "bun:test"
|
||||
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"
|
||||
import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
@@ -9,6 +9,10 @@ async function importFreshMigrationModule(): Promise<typeof import("./migrate-le
|
||||
return import(`./migrate-legacy-plugin-entry?test=${Date.now()}-${Math.random()}`)
|
||||
}
|
||||
|
||||
afterAll(() => {
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
describe("migrateLegacyPluginEntry", () => {
|
||||
let testDir = ""
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
declare const require: (name: string) => any
|
||||
const { describe, expect, test, beforeEach, mock } = require("bun:test")
|
||||
const { describe, expect, test, beforeEach, mock, afterAll } = require("bun:test")
|
||||
|
||||
const readConnectedProvidersCacheMock = mock(() => null)
|
||||
|
||||
@@ -7,6 +7,8 @@ mock.module("./connected-providers-cache", () => ({
|
||||
readConnectedProvidersCache: readConnectedProvidersCacheMock,
|
||||
}))
|
||||
|
||||
afterAll(() => { mock.restore() })
|
||||
|
||||
import { shouldRetryError, selectFallbackProvider } from "./model-error-classifier"
|
||||
|
||||
describe("model-error-classifier", () => {
|
||||
|
||||
@@ -19,6 +19,8 @@ mock.module("./opencode-storage-detection", () => ({
|
||||
resetSqliteBackendCache: () => {},
|
||||
}))
|
||||
|
||||
afterAll(() => { mock.restore() })
|
||||
|
||||
const { getMessageDir } = await import("./opencode-message-dir")
|
||||
|
||||
describe("getMessageDir", () => {
|
||||
|
||||
Reference in New Issue
Block a user