Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

Implements comprehensive unit testing for Lua configuration modules using busted framework, integrated with Nix build system.

Implementation

Test Suite (tests/)

  • helpers_spec.lua - Tests git_root() with edge cases (nil handles, empty results, whitespace trimming)
  • health_spec.lua - Tests health check system (program/LSP registration, check execution)
  • lazy_spec.lua - Tests lazy loading system (spec management, plugin loading)
  • example_spec.lua - Template demonstrating BDD patterns and vim API mocking

Integration

  • Added tests/default.nix as flake-parts module exposing packages.lua-tests and checks.lua-tests
  • Added busted to dev shell packages
  • Configured via .busted to exclude example template from test runs

Tooling

  • run-tests.sh - Convenience wrapper checking busted availability
  • tests/README.md - Usage documentation

Usage

# Development iteration
nix develop
busted tests/

# CI/production
nix build .#lua-tests
nix flake check

Tests mock vim APIs since they run outside Neovim runtime:

_G.vim = {
  fn = { executable = function() return 1 end },
  api = { nvim_create_autocmd = function() end },
  lsp = { config = {} }
}

Updated copilot instructions and validation steps to include test execution.

Original prompt

This section details on the original issue you should resolve

<issue_title>lua unit-tests (optional, but highly recommended)</issue_title>
<issue_description>Provide lua unit tests</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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


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

Copilot AI and others added 4 commits January 7, 2026 22:39
- Created tests directory with unit tests for helpers, health, and lazy modules
- Integrated busted testing framework via Nix
- Added test runner and checks to flake.nix
- Added .busted configuration
- Added tests/README.md with documentation
- Updated .gitignore for test artifacts
- Tests can be run with: nix build .#lua-tests or nix develop then busted

Co-authored-by: NobbZ <[email protected]>
- Added testing command to core commands section
- Updated common workflow for Lua changes to include testing
- Added tests/ directory to project structure documentation
- Updated validation steps to include running tests
- Added note about unit tests in important notes

Co-authored-by: NobbZ <[email protected]>
- Created example_spec.lua with common testing patterns
- Demonstrates assertions, mocking, and error handling
- Updated test README to reference example file
- Excluded example from actual test runs via .busted config

Co-authored-by: NobbZ <[email protected]>
- Created run-tests.sh for easy test execution in dev shell
- Updated test README with script usage
- Made script executable

Co-authored-by: NobbZ <[email protected]>
Copilot AI changed the title [WIP] Add lua unit tests for code coverage Add Lua unit testing infrastructure with busted Jan 7, 2026
Copilot AI requested a review from NobbZ January 7, 2026 22:44
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.

lua unit-tests (optional, but highly recommended)

2 participants