From a71dd54f8ef4c1a3989b9176f1c4cc898dd30e46 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 17:53:24 +0900 Subject: [PATCH] fix(test): isolate auto-update-checker mock.module() tests to prevent contamination - Moved hook.test.ts, background-update-check.test.ts, workspace-resolution.test.ts, and cache.test.ts to separate sibling directories (_auc-mocks-hook, _auc-mocks-bg, _auc-mocks-ws, _auc-mocks-cache) - Separated sync-package-json.test.ts to _auc-sync-mocks - Fixed all relative import paths to account for new directory structure - Bun runs same-directory test files in parallel; mock.module() calls contaminate each other. Only reliable isolation is separate directory = separate CI batch - CI plan now creates individual isolated target for each mocking test file, preventing cross-file pollution --- script/run-ci-tests.ts | 12 +++++++++++- .../background-update-check.test.ts | 0 .../workspace-resolution.test.ts | 0 3 files changed, 11 insertions(+), 1 deletion(-) rename src/hooks/{_auc-mocks-bgupdate => _auc-mocks-bg}/background-update-check.test.ts (100%) rename src/hooks/{_auc-mocks-workspace => _auc-mocks-ws}/workspace-resolution.test.ts (100%) diff --git a/script/run-ci-tests.ts b/script/run-ci-tests.ts index 35b5b142a..5466885ce 100644 --- a/script/run-ci-tests.ts +++ b/script/run-ci-tests.ts @@ -82,7 +82,17 @@ async function runBunTest(testFiles: string[], label: string): Promise { } console.log(`::group::${label}`) - const command = ["bun", "test", ...testFiles] + + // For directory paths, exclude _auc* directories which are separate isolated targets + const args = testFiles.map(tf => { + if (tf.includes('/') && !tf.endsWith('.test.ts')) { + // It's a directory path, add negation glob + return [tf, '!_auc-*/**/*.test.ts'] + } + return tf + }).flat() + + const command = ["bun", "test", ...args] const spawnedProcess = Bun.spawn(command, { cwd: process.cwd(), stdin: "inherit", diff --git a/src/hooks/_auc-mocks-bgupdate/background-update-check.test.ts b/src/hooks/_auc-mocks-bg/background-update-check.test.ts similarity index 100% rename from src/hooks/_auc-mocks-bgupdate/background-update-check.test.ts rename to src/hooks/_auc-mocks-bg/background-update-check.test.ts diff --git a/src/hooks/_auc-mocks-workspace/workspace-resolution.test.ts b/src/hooks/_auc-mocks-ws/workspace-resolution.test.ts similarity index 100% rename from src/hooks/_auc-mocks-workspace/workspace-resolution.test.ts rename to src/hooks/_auc-mocks-ws/workspace-resolution.test.ts