Skip to content

chore(tests): relocate agent-specific tests to tests/<agent>/#133

Merged
kaghni merged 3 commits into
mainfrom
chore/relocate-agent-specific-tests
May 14, 2026
Merged

chore(tests): relocate agent-specific tests to tests/<agent>/#133
kaghni merged 3 commits into
mainfrom
chore/relocate-agent-specific-tests

Conversation

@kaghni
Copy link
Copy Markdown
Collaborator

@kaghni kaghni commented May 13, 2026

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 for src/hooks/cursor/*, src/hooks/hermes/*, src/hooks/codex/*, and pi/extension-source/* were sitting under tests/claude-code/ despite testing other agents.

Destination Files moved
tests/cursor/ (new) cursor-*.test.ts
tests/hermes/ (new) hermes-*.test.ts
tests/codex/ (exists) codex-*.test.ts
tests/pi/ (new) pi-extension-source.test.ts

vitest.config.ts gains tests/cursor/, tests/hermes/, and tests/pi/ in its test.include globs. 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. From tests/cursor/ (or tests/hermes/, tests/pi/) that resolves to the same path it resolved to from tests/claude-code/ — same depth.

Out of scope (follow-up)

Many tests in tests/claude-code/ exercise generic src/ 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 flaky runGate env-default test) reproduce on origin/main with the same signature, confirming this PR introduces no new failures.
  • CI on this branch (will run after push).

Confidence: 95%, because the moves are pure git mv with 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 on origin/main.

Untested: full CI matrix on the published bundle (requires npm run build + the per-agent dist/ outputs that the build pipeline produces — local runs without a build show the same failures on main).

Summary by CodeRabbit

  • Tests
    • Updated test configuration to include additional test directories.

Note: This release contains only internal test infrastructure updates with no end-user-facing changes.

Review Change Stack

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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bb7b4a1-8599-4a6e-90f6-1089bc55e200

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Vitest configuration is updated to include two new test directory globs: tests/cursor/**/*.test.ts and tests/pi/**/*.test.ts. These additions enable test discovery in the reorganized agent-specific test directories.

Changes

Test Configuration Update

Layer / File(s) Summary
Register cursor and pi test directories in Vitest config
vitest.config.ts
Vitest test.include glob list extended with tests/cursor/** and tests/pi/** patterns to enable test discovery in newly organized agent-specific test directories alongside existing tests/hermes/** and tests/openclaw/** entries.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

Possibly related PRs

  • activeloopai/hivemind#126: Modifies vitest.config.ts's test discovery configuration to reorganize how agent test directories are registered with Vitest.

Poem

🐰 Four agents seek their testing home,
No more shall cursor, pi alone roam,
Through config globs they're found at last,
The test discovery web is cast!
Organized paths, the build runs true,
Vitest knows just what to do! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore(tests): relocate agent-specific tests to tests//' clearly summarizes the main change of reorganizing tests into per-agent directories.
Description check ✅ Passed The description comprehensively covers the rationale, specific files moved, configuration changes, test execution results, and confidence level, fulfilling all required template sections.
Linked Issues check ✅ Passed The PR successfully addresses all coding objectives from issue #132: creates new test directories, relocates all 16 specified tests, updates vitest.config.ts includes, and preserves path resolution depths.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #132's requirements. The PR explicitly defers broader test reorganization (~70 files in tests/claude-code/ for shared infrastructure) to future work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/relocate-agent-specific-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Coverage Report

No src/*.ts files changed in this PR.

Generated for commit 1324511.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 69c86ed and 21df218.

📒 Files selected for processing (17)
  • tests/codex/codex-capture-hook.test.ts
  • tests/codex/codex-session-start-hook.test.ts
  • tests/codex/codex-session-start-setup-hook.test.ts
  • tests/codex/codex-stop-hook.test.ts
  • tests/codex/codex-wiki-worker.test.ts
  • tests/cursor/cursor-capture-hook.test.ts
  • tests/cursor/cursor-pre-tool-use-hook.test.ts
  • tests/cursor/cursor-session-end-hook.test.ts
  • tests/cursor/cursor-session-start-hook.test.ts
  • tests/cursor/cursor-wiki-worker-source.test.ts
  • tests/hermes/hermes-capture-hook.test.ts
  • tests/hermes/hermes-pre-tool-use-hook.test.ts
  • tests/hermes/hermes-session-end-hook.test.ts
  • tests/hermes/hermes-session-start-hook.test.ts
  • tests/hermes/hermes-wiki-worker-source.test.ts
  • tests/pi/pi-extension-source.test.ts
  • vitest.config.ts

Comment thread vitest.config.ts
Comment on lines +24 to +27
"tests/cursor/**/*.test.ts",
"tests/hermes/**/*.test.ts",
"tests/openclaw/**/*.test.ts",
"tests/pi/**/*.test.ts",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 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.
@kaghni
Copy link
Copy Markdown
Collaborator Author

kaghni commented May 14, 2026

@coderabbitai what about now all good? all tests in correct locations?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Files remaining in tests/claude-code/ ==="
find tests/claude-code/ -name "*.test.ts" | sort

echo ""
echo "=== Files in tests/cursor/ ==="
find tests/cursor/ -name "*.test.ts" 2>/dev/null | sort || echo "(directory not found)"

echo ""
echo "=== Files in tests/hermes/ ==="
find tests/hermes/ -name "*.test.ts" 2>/dev/null | sort || echo "(directory not found)"

echo ""
echo "=== Files in tests/codex/ ==="
find tests/codex/ -name "*.test.ts" 2>/dev/null | sort || echo "(directory not found)"

echo ""
echo "=== Files in tests/pi/ ==="
find tests/pi/ -name "*.test.ts" 2>/dev/null | sort || echo "(directory not found)"

echo ""
echo "=== vitest.config.ts test.include globs ==="
grep -A 30 "include" vitest.config.ts | head -40

Length of output: 6691


@kaghni Yes, everything looks good! ✅ Here's a summary of what was verified:

Directory Files Status
tests/claude-code/ Only claude-code-specific tests remain ✅ No stray cursor/hermes/codex/pi files
tests/cursor/ 5 × cursor-*.test.ts
tests/hermes/ 5 × hermes-*.test.ts
tests/codex/ 9 × codex-*.test.ts
tests/pi/ 1 × pi-extension-source.test.ts

vitest.config.ts correctly includes all the new directories:

tests/cursor/**/*.test.ts
tests/hermes/**/*.test.ts
tests/codex/**/*.test.ts
tests/pi/**/*.test.ts

All acceptance criteria from issue #132 are satisfied — no cursor-*, hermes-*, codex-*, or pi-* files remain under tests/claude-code/, and the new per-agent directories are properly wired into the Vitest config. This PR is ready to merge! 🚀

@kaghni kaghni merged commit f0f9f0b into main May 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reorganize misplaced tests: agent-specific tests live in claude-code/tests/

1 participant