This directory contains resources for testing the Claude Code plugin.
There are two main components:
- Automated Tests: Unit and integration tests using the Plenary test framework.
- Manual Testing: A minimal configuration for reproducing issues and testing features.
The automated test suite covers the following components of the Claude Code plugin:
-
Core Functionality
- Plugin initialization and setup
- Command registration and execution
- Version reporting and management
-
Terminal Integration
- Terminal window creation and toggling
- Terminal positioning and configuration
- Insert mode management
-
Git Integration
- Git root detection and handling
- Error handling for non-git directories
-
Configuration
- Config validation for all settings
- Default config values
- Config merging with user-provided options
-
Keymaps
- Normal mode toggle keybindings
- Terminal mode toggle keybindings
- Window navigation keybindings
-
File Refresh
- Auto-refresh functionality
- Timer management
- Updatetime handling
The test suite currently contains 44 tests covering all major components of the plugin.
The minimal-init.lua file provides a minimal Neovim configuration for testing the Claude Code plugin in isolation. This standardized initialization file (recently renamed from minimal_init.lua to match conventions used across related Neovim projects) is useful for:
- Reproducing and debugging issues
- Testing new features in a clean environment
- Providing minimal reproducible examples when reporting bugs
# From the plugin root directory
nvim --clean -u tests/minimal-init.lua# Create a test directory
mkdir ~/claude-test
cp tests/minimal-init.lua ~/claude-test/
cd ~/claude-test
# Run Neovim with the minimal config
nvim --clean -u minimal-init.luaThe spec/ directory contains automated tests for the plugin using the plenary.busted framework.
The test suite is organized by module and functionality:
command_registration_spec.lua: Tests for command registrationconfig_spec.lua: Tests for configuration parsingconfig_validation_spec.lua: Tests for configuration validationcore_integration_spec.lua: Tests for core plugin integrationfile_refresh_spec.lua: Tests for file refresh functionalitygit_spec.lua: Tests for git integrationkeymaps_spec.lua: Tests for keybinding functionalityterminal_spec.lua: Tests for terminal integrationversion_spec.lua: Tests for version handling
Run all automated tests using:
./scripts/test.shYou'll see a summary of the test results like:
==== Test Results ====
Total Tests Run: 44
Successes: 44
Failures: 0
Errors: 0
=====================
Test files should follow the plenary.busted structure:
local assert = require('luassert')
local describe = require('plenary.busted').describe
local it = require('plenary.busted').it
describe('module_name', function()
describe('function_name', function()
it('should do something', function()
-- Test code here
assert.are.equal(expected, actual)
end)
end)
end)The minimal configuration:
- Attempts to auto-detect the plugin directory
- Sets up basic Neovim settings (no swap files, etc.)
- Prints available commands for reference
- Shows line numbers and sign column
To see error messages:
:messagesWhen reporting issues, please include the following information:
- Steps to reproduce the issue using this minimal config
- Any error messages from
:messages - The exact Neovim and Claude Code plugin versions