Skip to content

feat: add E2E test suite with GitHub Actions CI#19

Merged
Cannon07 merged 3 commits into
mainfrom
feat/e2e-tests
Apr 4, 2026
Merged

feat: add E2E test suite with GitHub Actions CI#19
Cannon07 merged 3 commits into
mainfrom
feat/e2e-tests

Conversation

@Cannon07

@Cannon07 Cannon07 commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add comprehensive E2E test suite with 31 tests covering core plugin logic and backend-specific integration
  • Plugin tests use plenary.nvim busted framework (standard Neovim plugin testing approach)
  • Backend tests use shell scripts to test the real JSON → shell → Neovim RPC pipeline
  • GitHub Actions CI runs on both Ubuntu and macOS with Neovim v0.10.4
  • Fix ESM compatibility issue in opencode-plugin/nvim.ts (use top-level imports instead of runtime require("fs"))

Test structure

tests/
├── minimal_init.lua                  # Plenary + plugin init for Lua tests
├── run.sh                            # Main orchestrator
├── run_lua.sh                        # Plenary busted runner
├── helpers.sh                        # Shell helpers (backend tests only)
├── plugin/                           # Lua tests (plenary busted)
│   ├── changes_registry_spec.lua     # 6 tests
│   └── diff_lifecycle_spec.lua       # 5 tests
└── backends/                         # Shell integration tests
    ├── claude/
    │   ├── test_edit.sh              # 8 tests (Edit, Write, Bash, replace_all, sequential)
    │   ├── test_install.sh           # 4 tests (install, uninstall, idempotent, preserves existing)
    │   └── test_stale_socket.sh      # 2 tests (restart recovery, missing Neovim)
    └── opencode/
        ├── harness.ts                # TypeScript test harness for OpenCode plugin
        ├── test_edit.sh              # 4 tests (edit, write, bash rm, relative paths)
        └── test_install.sh           # 2 tests (install, uninstall)

Running locally

./tests/run.sh                      # all tests (plugin + backends)
./tests/run.sh plugin               # core plugin tests only (plenary)
./tests/run.sh backends             # all backend tests
./tests/run.sh backends/claude      # Claude Code backend only
./tests/run.sh backends/opencode    # OpenCode backend only
./tests/run.sh install              # fuzzy match backend tests

Test plan

  • All 31 tests pass locally (macOS)
  • Plugin tests use plenary busted (standard Neovim testing framework)
  • Backend tests validate real hook payloads against Claude Code and OpenCode formats
  • Test payloads verified against Claude Code hook documentation and OpenCode SDK source
  • CI passes on Ubuntu
  • CI passes on macOS

🤖 Generated with Claude Code

Cannon07 and others added 3 commits April 4, 2026 18:01
Add comprehensive E2E test suite covering core plugin logic and
backend-specific integration tests.

Plugin tests (plenary busted):
- changes_registry_spec.lua — 6 tests for the changes module
- diff_lifecycle_spec.lua — 5 tests for the diff module

Backend integration tests (shell):
- backends/claude/ — Edit, Write, Bash, install, stale socket (14 tests)
- backends/opencode/ — Edit, Write, Bash, install (6 tests)

Also includes:
- GitHub Actions workflow (Ubuntu + macOS, Neovim 0.10.4)
- Fix: use ES module imports for writeFileSync/unlinkSync in
  opencode-plugin/nvim.ts (replaces runtime require("fs") calls
  that break in ESM context)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace `(( var++ ))` with `var=$((var + 1))` in test helpers.
When var is 0, `(( var++ ))` evaluates to 0 (falsy) and returns
exit code 1, which kills the script under `set -euo pipefail`
on bash 5.x (Ubuntu CI). macOS bash 3.2 doesn't trigger this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Cannon07
Cannon07 merged commit cf578f6 into main Apr 4, 2026
2 checks passed
@Cannon07
Cannon07 deleted the feat/e2e-tests branch April 4, 2026 12:43
kam-hak added a commit to kam-hak/claude-preview.nvim that referenced this pull request Apr 7, 2026
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.

1 participant