Skip to content

test: expand coverage with DSL edge cases, Lua syntax validation, and module smoke tests - #12

Merged
gytis-ivaskevicius merged 11 commits into
masterfrom
test-coverage-improvements
May 23, 2026
Merged

test: expand coverage with DSL edge cases, Lua syntax validation, and module smoke tests#12
gytis-ivaskevicius merged 11 commits into
masterfrom
test-coverage-improvements

Conversation

@gytis-ivaskevicius

Copy link
Copy Markdown
Owner

Summary

Triples the test surface from 4 checks to 47 total, adding three new layers of testing on top of the existing DSL unit tests, plus a CI pipeline.

Changes

Layer 1: DSL Unit Tests (28 new)

  • flatten: empty attrsets, deeply nested (11 levels), null values, shallow single-key
  • nix2lua: empty lists/attrs, bools, floats, nested lists/attrs, mixed types in lists
  • rawLua: bare value at top level, empty rawLua
  • toTable: simple, nested, empty
  • callWith: attrs, list, scalar, null, string arguments
  • attrs2Lua: empty config produces empty output

Layer 2: Lua Syntax Validation (9 new)

Generated Lua is parsed with lua -e "assert(loadfile(...))" to guarantee it is syntactically valid Lua, not just correctly structured Nix. Tests cover:

  • Minimal (empty config)
  • Settings, mappings, custom lua, vimscript
  • setup/require blocks, function definitions
  • Combined full config

Layer 3: Module Smoke Tests (10 new)

Each module is imported into evalModules and its generated Lua is validated for syntax:

  • essentials, git, nvim-tree, telescope, which-key, treesitter, lsp, nvchad, rust, ai
  • Combined test with all non-conflicting modules together

CI Pipeline

GitHub Actions workflow that runs nix flake check on push/PR to master, using DeterminateSystems nix-installer + magic-nix-cache.

How it works

  • evalLua: evaluates a nix2vim config via evalModules (same module set as neovim-builder) and returns the generated Lua string — no neovim build required
  • luaSyntaxCheck: writes the Lua to a store file and runs lua -e "assert(loadfile(...))" in a derivation — fails if the Lua has syntax errors

Running locally

nix flake check

gytis-ivaskevicius and others added 11 commits May 17, 2026 19:17
… module smoke tests

Adds three layers of testing beyond the existing 4 unit tests:

1. DSL Unit Tests (28 new)
   - Edge cases for flatten: empty, deeply nested, null
   - Edge cases for nix2lua: empty attrs/list, bools, floats, nested
   - Edge cases for rawLua, toTable, callWith, attrs2Lua

2. Lua Syntax Validation (9 new)
   - Generated Lua is checked with lua's loadfile() to ensure
     it parses as valid Lua. Tests cover: minimal config,
     settings, mappings, custom lua, vimscript, setup, functions,
     and a combined full config.

3. Module Smoke Tests (10 new)
   - Each module (essentials, git, nvim-tree, telescope, which-key,
     treesitter, lsp, nvchad, rust, ai) is imported and its
     generated Lua validated for syntax.
   - Combined test imports non-conflicting modules together.

Also adds CI pipeline via GitHub Actions:
   - Runs nix flake check on push/PR to master
mdDoc was removed from nixpkgs. In recent nixpkgs, markdown
is the default format for option descriptions, so the wrapper
is no longer needed and causes eval errors.
nodePackages was removed in nixpkgs; typescript-language-server is now
at pkgs.typescript-language-server and vscode-json-languageserver is now
vscode-langservers-extracted with the renamed binary vscode-json-language-server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nvim-treesitter removed the configs submodule in v1; update setup call
from nvim-treesitter.configs to nvim-treesitter. nvim-lspconfig deprecated
require('lspconfig').X.setup() in favour of vim.lsp.config/vim.lsp.enable
introduced in neovim 0.11.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
system_open, open_on_tab, update_cwd (top-level and nested) were dropped
in a recent nvim-tree.lua release. Also remove the nested update_cwd from
update_focused_file which was removed at the same time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both servers were attaching to any TypeScript file, causing them to fight
over the buffer and freeze nvim. ts_ls now only activates in Node projects
(package.json/tsconfig.json) and denols in Deno projects (deno.json).
Also remove the stale enable=true field from denols that leaked into the
server config with the new vim.lsp.config API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without this, denols falls back to the file's directory when no deno.json
is found, attaching to any TypeScript file outside a Deno project.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Re-enable single_file_support on denols so it attaches when no deno.json
is found, providing LSP coverage for files outside any project.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add statix.toml disabling W20 (repeated keys are intentional in the DSL)
- Auto-fix W04/W08/W11/W12 warnings via `statix fix`
- Add `statix check` step to CI workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Reformat all .nix files with nixfmt (RFC-style)
- Add nixfmt and statix checks to nix flake check
- Simplify CI to just nix flake check
@gytis-ivaskevicius
gytis-ivaskevicius merged commit 451986c into master May 23, 2026
1 check failed
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.

1 participant