Skip to content

Test runner for Zig in Neovim using Neotest backend.

License

Notifications You must be signed in to change notification settings

lawrence-laz/neotest-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neotest Zig ⚡

Zig v0.12 Neovim v0.10

Neotest test runner for Zig.

neotest-zig.mp4

⚙️ Requirements

📦 Setup

Install & configure using the package manager of your choice. Example using lazy.nvim:

return {
	"nvim-neotest/neotest",
	dependencies = {
		"lawrence-laz/neotest-zig", -- Installation
		"nvim-lua/plenary.nvim",
		"nvim-treesitter/nvim-treesitter",
		"antoinemadec/FixCursorHold.nvim",
	},
	config = function()
		require("neotest").setup({
			adapters = {
				-- Registration
				require("neotest-zig")({
					dap = {
						adapter = "lldb",
					}
				}),
			}
		})
	end
}

⭐ Features

  • Can run tests in individual .zig files and projects using build.zig
    • Does not support a mix of individual files and build.zig:w
    • buil.zig must have a standard test step
  • Exact test filtering
  • Timing all tests individually
  • Supports POSIX environments: Linux, MacOS and Windows (via WSL)

📄 Logs

Enabling logging in neotest automatically enables logging in neotest-zig as well:

require("neotest").setup({
    log_level = vim.log.levels.TRACE,
    -- ...
})

The logs can be openned by:

:exe 'edit' stdpath('log').'/neotest-zig.log'