Run busted tests with Neovim
32
stars
1,001
commits
Nix
primary language
Sep 6, 2026
updated
neorocksTest is a nix function
that allows you to run luarocks test
with Neovim as the Lua interpreter.busted
to test Neovim plugins (with and without Nix).So you can use busted to test your
Neovim plugins with access to the Neovim Lua API.
luarocks test documentation.testproject subdirectory.rockspec
and a .busted file in the project root.This project provides a Nix overlay with a neorocksTest function.
Here is an example of how to use it in a Nix flake:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
neorocks.url = "github:nvim-neorocks/neorocks";
};
outputs = {
self,
nixpkgs,
neorocks,
...
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
neorocks.overlays.default
];
};
in {
# ...
checks.${system} = {
neorocks-test = pkgs.neorocksTest {
src = self; # Project containing the rockspec and .busted files.
# Plugin name. If running multiple tests,
# you can use pname for the plugin name instead
name = "my-plugin.nvim"
version = "scm-1"; # Optional, defaults to "scm-1";
neovim = pkgs.neovim-nightly; # Optional, defaults to neovim-nightly.
luaPackages = ps: # Optional
with ps; [
# LuaRocks dependencies must be added here.
plenary-nvim
];
extraPackages = []; # Optional. External test runtime dependencies.
};
};
};
}
nix shell "github:nvim-neorocks/neorocks"
busted
nlua)See: mfussenegger/nlua
nluaTo run busted tests locally, without neorocks or neolua...
lua 5.1 and luarocks with your distribution's package manager.luarocks, lua_modules and .luarocks to your project's .gitignore.#!/bin/sh
export BUSTED_VERSION="2.1.2-3"
luarocks init
luarocks install busted "$BUSTED_VERSION"
luarocks config --scope project lua_version 5.1
nvim -u NONE \
-c "lua package.path='lua_modules/share/lua/5.1/?.lua;lua_modules/share/lua/5.1/?/init.lua;'..package.path;package.cpath='lua_modules/lib/lua/5.1/?.so;'..package.cpath;local k,l,_=pcall(require,'luarocks.loader') _=k and l.add_context('busted','$BUSTED_VERSION')" \
-l "lua_modules/lib/luarocks/rocks-5.1/busted/$BUSTED_VERSION/bin/busted" "$@"
dependencies and test_dependencies in your project's rockspec.testproject subdirectory.Note
If your tests are not in a
specdirectory, pass the name of the test directory to the script. e.g.,./run-tests.sh tests
nlua to run tests,
or to use the neorocksTest helper in a nix-based CI.tests job of
this project's CI
for an example on how to use neorocksTest with GitHub actions manually.970 commits
31 commits
Nix
77.8%
Lua
11.9%
Shell
10.3%
Run busted tests with Neovim
32
stars
1,001
commits
Nix
primary language
Sep 6, 2026
updated
neorocksTest is a nix function
that allows you to run luarocks test
with Neovim as the Lua interpreter.busted
to test Neovim plugins (with and without Nix).So you can use busted to test your
Neovim plugins with access to the Neovim Lua API.
luarocks test documentation.testproject subdirectory.rockspec
and a .busted file in the project root.This project provides a Nix overlay with a neorocksTest function.
Here is an example of how to use it in a Nix flake:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
neorocks.url = "github:nvim-neorocks/neorocks";
};
outputs = {
self,
nixpkgs,
neorocks,
...
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
neorocks.overlays.default
];
};
in {
# ...
checks.${system} = {
neorocks-test = pkgs.neorocksTest {
src = self; # Project containing the rockspec and .busted files.
# Plugin name. If running multiple tests,
# you can use pname for the plugin name instead
name = "my-plugin.nvim"
version = "scm-1"; # Optional, defaults to "scm-1";
neovim = pkgs.neovim-nightly; # Optional, defaults to neovim-nightly.
luaPackages = ps: # Optional
with ps; [
# LuaRocks dependencies must be added here.
plenary-nvim
];
extraPackages = []; # Optional. External test runtime dependencies.
};
};
};
}
nix shell "github:nvim-neorocks/neorocks"
busted
nlua)See: mfussenegger/nlua
nluaTo run busted tests locally, without neorocks or neolua...
lua 5.1 and luarocks with your distribution's package manager.luarocks, lua_modules and .luarocks to your project's .gitignore.#!/bin/sh
export BUSTED_VERSION="2.1.2-3"
luarocks init
luarocks install busted "$BUSTED_VERSION"
luarocks config --scope project lua_version 5.1
nvim -u NONE \
-c "lua package.path='lua_modules/share/lua/5.1/?.lua;lua_modules/share/lua/5.1/?/init.lua;'..package.path;package.cpath='lua_modules/lib/lua/5.1/?.so;'..package.cpath;local k,l,_=pcall(require,'luarocks.loader') _=k and l.add_context('busted','$BUSTED_VERSION')" \
-l "lua_modules/lib/luarocks/rocks-5.1/busted/$BUSTED_VERSION/bin/busted" "$@"
dependencies and test_dependencies in your project's rockspec.testproject subdirectory.Note
If your tests are not in a
specdirectory, pass the name of the test directory to the script. e.g.,./run-tests.sh tests
nlua to run tests,
or to use the neorocksTest helper in a nix-based CI.tests job of
this project's CI
for an example on how to use neorocksTest with GitHub actions manually.970 commits
31 commits
Nix
77.8%
Lua
11.9%
Shell
10.3%