chore(tests): relocate agent-specific tests to tests/<agent>/#133
Conversation
Moves 16 tests out of tests/claude-code/ into the correct per-agent directories. These tests exercise src/hooks/cursor/*, src/hooks/hermes/*, src/hooks/codex/*, and pi/extension-source/*, so they belong under tests/cursor/, tests/hermes/, tests/codex/, and tests/pi/ respectively (the same per-agent layout the repo already uses for tests/codex/ and tests/openclaw/). vitest.config.ts gains tests/cursor/, tests/hermes/, and tests/pi/ in its include globs. No test source changes were needed: every relocated test that reads files by path uses join(__dirname, "..", "..") to reach repo root, and that resolves to the same path from tests/<agent>/ as from tests/claude-code/. Closes #132
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughVitest configuration is updated to include two new test directory globs: ChangesTest Configuration Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Coverage ReportNo Generated for commit 1324511. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@vitest.config.ts`:
- Around line 24-27: The vitest configuration still misses/points to the
migrated agent tests: update the test globs in vitest.config.ts to include the
remaining CLI install tests from tests/claude-code (or move those files into the
correct agent folders) and resolve the agent name mismatch by replacing or
confirming "tests/openclaw/**/*.test.ts" vs the intended
"tests/codex/**/*.test.ts"; specifically either move
cli-install-cursor-fs.test.ts, cli-install-pi-fs.test.ts,
cli-install-codex-fs.test.ts into their respective agent dirs (tests/cursor/,
tests/pi/, tests/codex/) or add globs for tests/claude-code/**/*.test.ts (or
rename openclaw to codex in the config) so vitest picks up all agent-specific
tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2ead92d9-972d-458a-85a8-3214c1a1bf93
📒 Files selected for processing (17)
tests/codex/codex-capture-hook.test.tstests/codex/codex-session-start-hook.test.tstests/codex/codex-session-start-setup-hook.test.tstests/codex/codex-stop-hook.test.tstests/codex/codex-wiki-worker.test.tstests/cursor/cursor-capture-hook.test.tstests/cursor/cursor-pre-tool-use-hook.test.tstests/cursor/cursor-session-end-hook.test.tstests/cursor/cursor-session-start-hook.test.tstests/cursor/cursor-wiki-worker-source.test.tstests/hermes/hermes-capture-hook.test.tstests/hermes/hermes-pre-tool-use-hook.test.tstests/hermes/hermes-session-end-hook.test.tstests/hermes/hermes-session-start-hook.test.tstests/hermes/hermes-wiki-worker-source.test.tstests/pi/pi-extension-source.test.tsvitest.config.ts
| "tests/cursor/**/*.test.ts", | ||
| "tests/hermes/**/*.test.ts", | ||
| "tests/openclaw/**/*.test.ts", | ||
| "tests/pi/**/*.test.ts", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify that test files have been moved to new locations and removed from old location.
echo "=== Checking new test directories exist and contain tests ==="
for dir in tests/cursor tests/hermes tests/pi; do
if [ -d "$dir" ]; then
count=$(fd -e ts -t f . "$dir" | wc -l)
echo "✓ $dir exists with $count test files"
fd -e ts -t f . "$dir" | head -5
else
echo "✗ $dir does not exist"
fi
done
echo ""
echo "=== Checking tests/claude-code/ for any remaining agent-specific tests ==="
echo "Looking for cursor-*, hermes-*, codex-*, and pi-* test files that should have been moved:"
fd -t f -g '*cursor-*.test.ts' tests/claude-code/ 2>/dev/null || echo "✓ No cursor-* tests remaining"
fd -t f -g '*hermes-*.test.ts' tests/claude-code/ 2>/dev/null || echo "✓ No hermes-* tests remaining"
fd -t f -g '*codex-*.test.ts' tests/claude-code/ 2>/dev/null || echo "✓ No codex-* tests remaining"
fd -t f -g '*pi-*.test.ts' tests/claude-code/ 2>/dev/null || echo "✓ No pi-* tests remaining"Repository: activeloopai/hivemind
Length of output: 1082
Test migration is incomplete; some agent-specific test files remain in tests/claude-code/.
The core test reorganization partially succeeded:
- ✓
tests/cursor/,tests/hermes/,tests/pi/contain the expected test files - ✗
tests/claude-code/still contains:cli-install-cursor-fs.test.ts,cli-install-codex-fs.test.ts,cli-install-pi-fs.test.ts
These remaining CLI install tests for cursor, pi, and codex should either be moved to their respective agent directories or the config should be updated to include them. Additionally, the vitest.config.ts shows tests/openclaw/**/*.test.ts but the original PR summary references codex—clarify which agent framework is correct.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@vitest.config.ts` around lines 24 - 27, The vitest configuration still
misses/points to the migrated agent tests: update the test globs in
vitest.config.ts to include the remaining CLI install tests from
tests/claude-code (or move those files into the correct agent folders) and
resolve the agent name mismatch by replacing or confirming
"tests/openclaw/**/*.test.ts" vs the intended "tests/codex/**/*.test.ts";
specifically either move cli-install-cursor-fs.test.ts,
cli-install-pi-fs.test.ts, cli-install-codex-fs.test.ts into their respective
agent dirs (tests/cursor/, tests/pi/, tests/codex/) or add globs for
tests/claude-code/**/*.test.ts (or rename openclaw to codex in the config) so
vitest picks up all agent-specific tests.
Addresses PR #133 review: per-agent install tests were stranded in tests/claude-code/ but exercise src/cli/install-*.ts, not the Claude Code agent runtime. Group all CLI-layer tests under tests/cli/ so the directory matches the source layout and future cli-* tests have an obvious home. Moved 15 files from tests/claude-code/ to tests/cli/: cli-auth, cli-embeddings, cli-index, cli-update, cli-util, cli-version, install-end-to-end, install-helpers, cli-install-{claude,codex-fs,cursor-fs,hermes,mcp-shared, openclaw,pi-fs}. vitest.config.ts: include "tests/cli/**/*.test.ts". Path resolution depth (../../) is identical from tests/claude-code/ and tests/cli/, so no test source changes are needed. All 287 tests in the moved set pass.
|
@coderabbitai what about now all good? all tests in correct locations? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 6691
All acceptance criteria from issue |
Summary
Closes #132.
Moves 16 tests out of
tests/claude-code/into the per-agent directory that owns the code they exercise. The repo already uses a per-agent test layout (tests/codex/,tests/openclaw/), but tests forsrc/hooks/cursor/*,src/hooks/hermes/*,src/hooks/codex/*, andpi/extension-source/*were sitting undertests/claude-code/despite testing other agents.tests/cursor/(new)cursor-*.test.tstests/hermes/(new)hermes-*.test.tstests/codex/(exists)codex-*.test.tstests/pi/(new)pi-extension-source.test.tsvitest.config.tsgainstests/cursor/,tests/hermes/, andtests/pi/in itstest.includeglobs. Coverage thresholds are untouched (they key on source paths, not test paths).No test source changes needed: every relocated test that reads files by path uses
join(__dirname, "..", "..")to reach repo root. Fromtests/cursor/(ortests/hermes/,tests/pi/) that resolves to the same path it resolved to fromtests/claude-code/— same depth.Out of scope (follow-up)
Many tests in
tests/claude-code/exercise genericsrc/infrastructure shared across all agents (src/embeddings/,src/skillify/,src/notifications/,src/cli/,src/deeplake-api.ts,src/utils/, etc.). These should arguably live in a shared location rather than under any one agent. That is a ~70-file move and is left for a separate PR — this one fixes only the clearer cross-agent contamination.Test plan
npx vitest run tests/cursor tests/hermes tests/codex tests/pi— 20 files / 304 tests pass in their new locations.npx vitest run— pre-existing failures unrelated to this PR (bundle-build-dependent suites + a flakyrunGateenv-default test) reproduce onorigin/mainwith the same signature, confirming this PR introduces no new failures.Confidence: 95%, because the moves are pure
git mvwith no path-resolution depth change (2 levels up to repo root either way), the relocated test set runs green in the new layout, and the only remaining failures reproduce identically onorigin/main.Untested: full CI matrix on the published bundle (requires
npm run build+ the per-agentdist/outputs that the build pipeline produces — local runs without a build show the same failures onmain).Summary by CodeRabbit
Note: This release contains only internal test infrastructure updates with no end-user-facing changes.