diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f22750..d1a791c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,10 +49,10 @@ jobs: version: ${{ matrix.neovim-version }} - name: Run Luacheck - run: nix develop .#ci -c luacheck lua/ tests/ --no-unused-args --no-max-line-length + run: nix develop .#ci -c make check - name: Run tests - run: nix develop .#ci -c ./run_tests.sh + run: nix develop .#ci -c make test - name: Check formatting run: nix flake check diff --git a/CLAUDE.md b/CLAUDE.md index af37896..970d940 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,8 +10,7 @@ claudecode.nvim - A Neovim plugin that implements the same WebSocket-based MCP p ### Testing -- `make test` - Run all tests using busted -- `./run_tests.sh` - Direct test runner script +- `make test` - Run all tests using busted with coverage - `busted tests/unit/specific_spec.lua` - Run specific test file - `busted --coverage -v` - Run tests with coverage @@ -85,3 +84,7 @@ Test files follow the pattern `*_spec.lua` or `*_test.lua` and use the busted fr - WebSocket server only accepts local connections for security - Selection tracking is debounced to reduce overhead - Terminal integration supports both snacks.nvim and native Neovim terminal + +## CRITICAL: Pre-commit Requirements + +**ALWAYS run `make` before committing any changes.** This runs code quality checks and formatting that must pass for CI to succeed. Never skip this step - many PRs fail CI because contributors don't run the build commands before committing. diff --git a/Makefile b/Makefile index 3222f5b..2c2b329 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,16 @@ format: # Run tests test: - @echo "Running tests..." - @./run_tests.sh + @echo "Running all tests..." + @export LUA_PATH="./lua/?.lua;./lua/?/init.lua;./?.lua;./?/init.lua;$$LUA_PATH"; \ + TEST_FILES=$$(find tests -type f -name "*_test.lua" -o -name "*_spec.lua" | sort); \ + echo "Found test files:"; \ + echo "$$TEST_FILES"; \ + if [ -n "$$TEST_FILES" ]; then \ + $(NIX_PREFIX) busted --coverage -v $$TEST_FILES; \ + else \ + echo "No test files found"; \ + fi # Clean generated files clean: diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index c180db7..0000000 --- a/run_tests.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Set the correct Lua path to include project files -export LUA_PATH="./lua/?.lua;./lua/?/init.lua;./?.lua;./?/init.lua;$LUA_PATH" - -cd "$(dirname "$0")" || exit -echo "Running all tests..." - -TEST_FILES=$(find tests -type f -name "*_test.lua" -o -name "*_spec.lua" | sort) -echo "Found test files:" -echo "$TEST_FILES" - -if [ -n "$TEST_FILES" ]; then - # Pass test files to busted with coverage flag - quotes needed but shellcheck disabled as we need word splitting - # shellcheck disable=SC2086 - busted --coverage -v $TEST_FILES -else - echo "No test files found" -fi