fix(ci): isolate mock-heavy shared tests to prevent cross-file contamination
Move 4 src/shared tests that use mock.module() to the isolated test section: - model-capabilities.test.ts (mocks ./connected-providers-cache) - log-legacy-plugin-startup-warning.test.ts (mocks ./legacy-plugin-warning) - model-error-classifier.test.ts - opencode-message-dir.test.ts Also isolate recover-tool-result-missing.test.ts (mocks ./storage). Use find + exclusion pattern in remaining tests to dynamically build the src/shared file list without the isolated mock-heavy files. Fixes 6 Linux CI failures caused by bun's mock.module() cache pollution when running in parallel.
This commit is contained in:
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -60,16 +60,31 @@ jobs:
|
||||
bun test src/features/opencode-skill-loader/loader.test.ts
|
||||
bun test src/hooks/anthropic-context-window-limit-recovery/recovery-hook.test.ts
|
||||
bun test src/hooks/anthropic-context-window-limit-recovery/executor.test.ts
|
||||
# src/shared mock-heavy files (mock.module pollutes connected-providers-cache and legacy-plugin-warning)
|
||||
bun test src/shared/model-capabilities.test.ts
|
||||
bun test src/shared/log-legacy-plugin-startup-warning.test.ts
|
||||
bun test src/shared/model-error-classifier.test.ts
|
||||
bun test src/shared/opencode-message-dir.test.ts
|
||||
# session-recovery mock isolation (recover-tool-result-missing mocks ./storage)
|
||||
bun test src/hooks/session-recovery/recover-tool-result-missing.test.ts
|
||||
|
||||
- name: Run remaining tests
|
||||
run: |
|
||||
# Enumerate subdirectories/files explicitly to EXCLUDE mock-heavy files
|
||||
# that were already run in isolation above.
|
||||
# Excluded from src/shared: model-capabilities, log-legacy-plugin-startup-warning, model-error-classifier, opencode-message-dir
|
||||
# Excluded from src/cli: doctor/formatter.test.ts, doctor/format-default.test.ts
|
||||
# Excluded from src/tools: call-omo-agent/sync-executor.test.ts, call-omo-agent/session-creator.test.ts, session-manager (all)
|
||||
# Excluded from src/hooks/anthropic-context-window-limit-recovery: recovery-hook.test.ts, executor.test.ts
|
||||
# Build src/shared file list excluding mock-heavy files already run in isolation
|
||||
SHARED_FILES=$(find src/shared -name '*.test.ts' \
|
||||
! -name 'model-capabilities.test.ts' \
|
||||
! -name 'log-legacy-plugin-startup-warning.test.ts' \
|
||||
! -name 'model-error-classifier.test.ts' \
|
||||
! -name 'opencode-message-dir.test.ts' \
|
||||
| sort | tr '\n' ' ')
|
||||
bun test bin script src/config src/mcp src/index.test.ts \
|
||||
src/agents src/shared \
|
||||
src/agents $SHARED_FILES \
|
||||
src/cli/run src/cli/config-manager src/cli/mcp-oauth \
|
||||
src/cli/index.test.ts src/cli/install.test.ts src/cli/model-fallback.test.ts \
|
||||
src/cli/config-manager.test.ts \
|
||||
@@ -82,6 +97,7 @@ jobs:
|
||||
src/tools/call-omo-agent/background-executor.test.ts \
|
||||
src/tools/call-omo-agent/subagent-session-creator.test.ts \
|
||||
src/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.test.ts src/hooks/anthropic-context-window-limit-recovery/parser.test.ts src/hooks/anthropic-context-window-limit-recovery/pruning-deduplication.test.ts src/hooks/anthropic-context-window-limit-recovery/recovery-deduplication.test.ts src/hooks/anthropic-context-window-limit-recovery/storage.test.ts \
|
||||
src/hooks/session-recovery/detect-error-type.test.ts src/hooks/session-recovery/index.test.ts src/hooks/session-recovery/recover-empty-content-message-sdk.test.ts src/hooks/session-recovery/resume.test.ts src/hooks/session-recovery/storage \
|
||||
src/hooks/claude-code-compatibility \
|
||||
src/hooks/context-injection \
|
||||
src/hooks/provider-toast \
|
||||
|
||||
Reference in New Issue
Block a user