From 0c3f8b7bfafa79d1e35d79bf1ff9239b9a385c8b Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 17:28:52 +0900 Subject: [PATCH] fix(test): isolate sync-package-json test to prevent node:fs mock contamination sync-package-json.test.ts mocks node:fs which leaks into plugin-entry.test.ts running in the same CI batch. Move to checker/sync/ subdirectory for isolation. --- .../checker/{ => sync}/sync-package-json.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/hooks/auto-update-checker/checker/{ => sync}/sync-package-json.test.ts (97%) diff --git a/src/hooks/auto-update-checker/checker/sync-package-json.test.ts b/src/hooks/auto-update-checker/checker/sync/sync-package-json.test.ts similarity index 97% rename from src/hooks/auto-update-checker/checker/sync-package-json.test.ts rename to src/hooks/auto-update-checker/checker/sync/sync-package-json.test.ts index 4f5bd42a5..eb0f8a0ff 100644 --- a/src/hooks/auto-update-checker/checker/sync-package-json.test.ts +++ b/src/hooks/auto-update-checker/checker/sync/sync-package-json.test.ts @@ -1,14 +1,14 @@ import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test" import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs" import { join } from "node:path" -import type { PluginEntryInfo } from "./plugin-entry" +import type { PluginEntryInfo } from "../plugin-entry" const TEST_CACHE_DIR = join(import.meta.dir, "__test-sync-cache__") let importCounter = 0 -async function importFreshSyncPackageJsonModule(): Promise { - mock.module("../constants", () => ({ +async function importFreshSyncPackageJsonModule(): Promise { + mock.module("../../constants", () => ({ CACHE_DIR: TEST_CACHE_DIR, PACKAGE_NAME: "oh-my-opencode", NPM_REGISTRY_URL: "https://registry.npmjs.org/-/package/oh-my-opencode/dist-tags", @@ -21,11 +21,11 @@ async function importFreshSyncPackageJsonModule(): Promise null, })) - mock.module("../../../shared/logger", () => ({ + mock.module("../../../../shared/logger", () => ({ log: () => {}, })) - const syncPackageJsonModule = await import(`./sync-package-json?test=${importCounter++}`) + const syncPackageJsonModule = await import(`../sync-package-json?test=${importCounter++}`) mock.restore() return syncPackageJsonModule }