Skip to content

refactor: move test runner from shell script to Makefile #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 0 additions & 19 deletions run_tests.sh

This file was deleted.