@@ -5,24 +5,36 @@ local config = require("neotest-busted.config")
5
5
6
6
local min_neovim_version = " 0.9.0"
7
7
8
+ local report_start = vim .health .report_start
9
+ local report_ok = vim .health .report_ok
10
+ local report_error = vim .health .report_error
11
+ local report_warn = vim .health .report_warn
12
+
13
+ if vim .fn .has (" nvim-0.10" ) == 1 then
14
+ report_start = vim .health .start
15
+ report_ok = vim .health .ok
16
+ report_error = vim .health .error
17
+ report_warn = vim .health .warn
18
+ end
19
+
8
20
--- @param module_name string
9
21
local function check_module_installed (module_name )
10
22
local installed , _ = pcall (require , module_name )
11
23
12
24
if installed then
13
- vim . health . report_ok ((" `%s` is installed" ):format (module_name ))
25
+ report_ok ((" `%s` is installed" ):format (module_name ))
14
26
else
15
- vim . health . report_error ((" `%s` is not installed" ):format (module_name ))
27
+ report_error ((" `%s` is not installed" ):format (module_name ))
16
28
end
17
29
end
18
30
19
31
function health .check ()
20
- vim . health . report_start (" neotest-busted" )
32
+ report_start (" neotest-busted" )
21
33
22
34
if vim .fn .has (" nvim-" .. min_neovim_version ) == 1 then
23
- vim . health . report_ok ((" has neovim %s+" ):format (min_neovim_version ))
35
+ report_ok ((" has neovim %s+" ):format (min_neovim_version ))
24
36
else
25
- vim . health . report_error (" neotest-busted requires at least neovim " .. min_neovim_version )
37
+ report_error (" neotest-busted requires at least neovim " .. min_neovim_version )
26
38
end
27
39
28
40
-- NOTE: We cannot check the neotest version because it isn't advertised as
@@ -33,24 +45,24 @@ function health.check()
33
45
local ok , error = config .validate (config )
34
46
35
47
if ok then
36
- vim . health . report_ok (" found no errors in config" )
48
+ report_ok (" found no errors in config" )
37
49
else
38
- vim . health . report_error (" config has errors: " .. error )
50
+ report_error (" config has errors: " .. error )
39
51
end
40
52
41
53
-- We skip looking for a local luarocks installation as the healthcheck
42
54
-- could have been invoked from anywhere
43
55
local busted = adapter .find_busted_command (true )
44
56
45
57
if busted then
46
- vim . health . report_ok (
58
+ report_ok (
47
59
(" found `busted` (type: %s) at\n %s" ):format (
48
60
busted .type ,
49
61
vim .loop .fs_realpath (busted .command )
50
62
)
51
63
)
52
64
else
53
- vim . health . report_warn (
65
+ report_warn (
54
66
" could not find busted executable globally or in user home folder" ,
55
67
" if not already installed locally, please install busted using luarocks (https://luarocks.org/)"
56
68
)
0 commit comments