Skip to content

Commit 4278bcb

Browse files
authored
feat: allow specifying the binary to launch neovim in tests (#449)
Use case: Run tests for neovim derivations packaged with Nix. See also: * NixOS/nixpkgs#78033 * mrcjkb/haskell-tools.nvim#93 (comment)
1 parent 9d81624 commit 4278bcb

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ Where the first argument is the directory you'd like to test. It will search for
229229
the pattern `*_spec.lua` and execute them in separate neovim instances.
230230

231231
The second argument is a Lua option table with the following fields:
232+
- `nvim_cmd`: specify the command to launch this neovim instance (defaults to `vim.v.progpath`)
232233
- `minimal_init`: specify an init.vim to use for this instance, uses `--noplugin`
233234
- `minimal`: uses `--noplugin` without an init script (overrides `minimal_init`)
234235
- `sequential`: whether to run tests sequentially (default is to run in parallel)

lua/plenary/test_harness.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ end
4141
function harness.test_directory(directory, opts)
4242
print "Starting..."
4343
opts = vim.tbl_deep_extend("force", {
44+
nvim_cmd = vim.v.progpath,
4445
winopts = { winblend = 3 },
4546
sequential = false,
4647
keep_going = true,
@@ -95,7 +96,7 @@ function harness.test_directory(directory, opts)
9596
end
9697

9798
local job = Job:new {
98-
command = vim.v.progpath,
99+
command = opts.nvim_cmd,
99100
args = args,
100101

101102
-- Can be turned on to debug

0 commit comments

Comments
 (0)