test: harden workspace package assumptions

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-18 21:19:48 +09:00
parent a86cc6af18
commit 90b3f4ac96
2 changed files with 1 additions and 7 deletions
@@ -21,7 +21,7 @@ function getNestedRecord(record: Record<string, unknown>, key: string): Record<s
async function loadSeparateHostZodModule(): Promise<typeof import("zod")> {
const pluginPackageDirectory = dirname(Bun.resolveSync("@opencode-ai/plugin/package.json", import.meta.dir))
const sourceZodDirectory = join(pluginPackageDirectory, "node_modules", "zod")
const sourceZodDirectory = dirname(Bun.resolveSync("zod/package.json", pluginPackageDirectory))
const tempDirectory = mkdtempSync(join(tmpdir(), "omo-host-zod-"))
const copiedZodDirectory = join(tempDirectory, "zod")
@@ -6,11 +6,6 @@ import ts from "typescript"
const SOURCE_ROOT = path.resolve(import.meta.dir, "..")
const MOCK_MODULE_TOKEN = "mock.module"
const MOCK_MODULE_LIFECYCLE_ALLOWLIST = new Map<string, string>([
// TODO(MOCK-MODULE-AUDIT): add cleanup for ast-grep tool module mocks.
[
path.join(SOURCE_ROOT, "tools", "ast-grep", "tools.test.ts"),
"justification: legacy mock.module call predates audit; TODO(MOCK-MODULE-AUDIT): add cleanup",
],
// TODO(MOCK-MODULE-AUDIT): add cleanup for team mailbox inbox module mocks.
[
path.join(SOURCE_ROOT, "features", "team-mode", "team-mailbox", "inbox.test.ts"),
@@ -195,7 +190,6 @@ describe("mock.module lifecycle hygiene", () => {
if (!contents.includes(MOCK_MODULE_TOKEN)) {
continue
}
const sourceFile = ts.createSourceFile(filePath, contents, ts.ScriptTarget.Latest, true)
if (hasMockModuleCall(sourceFile) && !hasCleanupPattern(sourceFile)) {
offenders.push(relativeSourcePath(filePath))