$ show klen/nvim-test
nvim-test is a Neovim plugin that provides a unified interface for running tests across multiple programming languages. It integrates with Neovim's terminal system to execute test commands (like jest, pytest, etc.) and displays results in a split window. The plugin features language-specific runners that use tree-sitter queries to identify test functions and navigate to the nearest test from the cursor. Key components include a base Runner class for abstraction, utility functions for file path resolution, and terminal adapters for both built-in and toggleterm implementations. The plugin is actively maintained with recent commits and CI workflows, showing low technical debt as it relies on Neovim's stable APIs and external test runners without complex dependencies.
The LLM identified 2 files worth highlighting for reuse:
The Runner base class defines an extensible framework for language-specific test runners. It encapsulates common logic like finding the nearest test using tree-sitter queries, resolving test files, and building command arguments. Language-specific runners inherit from this class, implementing only the tree-sitter query and command-building details. This demonstrates strong abstraction principles and could be reused in other Neovim plugins needing test integration.
This module provides reusable helper functions for file system operations and Neovim buffer interactions. Key functions include find_file_by_patterns (locates files using glob patterns with variable substitution), find_relative_root (identifies project root via markers like .git), and resolve_dimensions (handles dynamic terminal sizing). These functions are loosely coupled, pure Lua where possible, and solve common problems in Neovim plugin development, making them suitable for extraction into standalone utilities.