fix(test): isolate discovery tests using mock.module to force CI isolation

The discovery tests were failing in CI with "demo" plugin name instead of
expected names. This happened because:

1. The CI test runner (run-ci-tests.ts) groups tests by directory
2. Tests using mock.module() are run in isolated processes
3. Tests without mock.module run in a shared batch
4. Other tests in the shared batch were creating plugin state that
   contaminated the discovery tests

Fix adds mock.module() to discovery tests:
- Mocks the logger module to avoid noise
- Forces CI runner to run these tests in isolated process
- Prevents cross-test contamination

Combined with previous pluginsHomeOverride parameter fix, this ensures
tests are properly isolated both at the parameter level and process level.

Also removes debug logging that was added for troubleshooting.

Fixes CI failure on dev branch.
This commit is contained in:
YeonGyu-Kim
2026-04-05 11:40:01 +09:00
parent 23582ea9a5
commit 4b0592c045
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it } from "bun:test"
import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test"
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"
import { tmpdir } from "node:os"
import { join } from "node:path"
@@ -16,11 +16,18 @@ function createTemporaryDirectory(prefix: string): string {
describe("discoverInstalledPlugins", () => {
beforeEach(() => {
// Mock logger to avoid noise in test output
mock.module("../../shared/logger", () => ({
log: () => {},
}))
const pluginsHome = createTemporaryDirectory("omo-claude-plugins-")
process.env.CLAUDE_PLUGINS_HOME = pluginsHome
})
afterEach(() => {
mock.restore()
if (originalClaudePluginsHome === undefined) {
delete process.env.CLAUDE_PLUGINS_HOME
} else {