Skip to content

Commit 73c910b

Browse files
Validate busted executable only in healthcheck (#26)
1 parent ab73916 commit 73c910b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lua/neotest-busted/config.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ end
4141

4242
--- Validate a config
4343
---@param _config neotest-busted.Config
44+
---@param skip_executable_check? boolean
4445
---@return boolean
4546
---@return any?
46-
function config.validate(_config)
47+
function config.validate(_config, skip_executable_check)
4748
-- stylua: ignore start
4849
local ok, error = pcall(vim.validate, {
4950
busted_command = {
@@ -82,7 +83,7 @@ function config.validate(_config)
8283
return ok, error
8384
end
8485

85-
if type(_config.busted_command) == "string" then
86+
if not skip_executable_check and type(_config.busted_command) == "string" then
8687
if vim.fn.executable(_config.busted_command) == 0 then
8788
return false, "busted command in configuration is not executable"
8889
end
@@ -97,7 +98,10 @@ end
9798
function config.configure(user_config)
9899
_user_config = vim.tbl_deep_extend("keep", user_config or {}, default_config)
99100

100-
local ok, error = config.validate(_user_config)
101+
-- Skip checking the executable when running setup to avoid the error
102+
-- message as neotest loads all adapters so users will see an error in a
103+
-- non-lua/neovim directory with a relative path in `busted_command`
104+
local ok, error = config.validate(_user_config, true)
101105

102106
if not ok then
103107
vim.api.nvim_echo({

0 commit comments

Comments
 (0)