diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index eb198e472..fe1638e89 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,16 +45,34 @@ jobs: env: BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" - - name: Run tests + - name: Run mock-heavy tests (isolated) run: | - # Run tests that use mock.module() in isolated processes first - bun test src/plugin-handlers/config-handler.test.ts - bun test src/hooks/compaction-context-injector/index.test.ts - # Run remaining tests (find all test files, exclude mock-heavy ones, run in single batch) - find src -name '*.test.ts' \ - ! -path '**/config-handler.test.ts' \ - ! -path '**/compaction-context-injector/index.test.ts' \ - | xargs bun test + # These files use mock.module() which pollutes module cache + # Run them in separate processes to prevent cross-file contamination + bun test src/plugin-handlers + bun test src/hooks/atlas + bun test src/hooks/compaction-context-injector + bun test src/features/tmux-subagent + + - name: Run remaining tests + run: | + # Run all other tests (mock-heavy ones are re-run but that's acceptable) + bun test bin script src/cli src/config src/mcp src/index.test.ts \ + src/agents src/tools src/shared \ + src/hooks/anthropic-context-window-limit-recovery \ + src/hooks/claude-code-compatibility \ + src/hooks/context-injection \ + src/hooks/provider-toast \ + src/hooks/session-notification \ + src/hooks/sisyphus \ + src/hooks/todo-continuation-enforcer \ + src/features/background-agent \ + src/features/builtin-commands \ + src/features/builtin-skills \ + src/features/claude-code-session-state \ + src/features/hook-message-injector \ + src/features/opencode-skill-loader \ + src/features/skill-mcp-manager typecheck: runs-on: ubuntu-latest