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
This commit is contained in:
+11
-1
@@ -82,7 +82,17 @@ async function runBunTest(testFiles: string[], label: string): Promise<void> {
|
||||
}
|
||||
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user