@@ -41,6 +41,10 @@ Setup with neotest. Leave values as `nil` to leave them unspecified.
41
41
-- Custom config to load via -u to set up testing.
42
42
-- If nil, will look for a 'minimal_init.lua' file
43
43
minimal_init = "custom_init.lua",
44
+ -- Only use a luarocks installation in the project's directory. If
45
+ -- true, installations in $HOME and global installations will be
46
+ -- ignored. Useful for isolating the test environment
47
+ local_luarocks_only = true,
44
48
}),
45
49
},
46
50
})
@@ -100,6 +104,13 @@ precedence over a global install). You can check the installation by running
100
104
`luarocks list busted`.
101
105
102
106
107
+ [!WARNING ] If you have set `busted_command` to a non-nil value in the `setup`
108
+ function, `neotest- busted` will not know where to look for appropriate lua
109
+ paths and will not look for installations as specified below to avoid setting
110
+ up paths for a different busted installation.
111
+ In this case, you should set `busted_paths` and `busted_cpaths` to appropriate
112
+ paths.
113
+
103
114
DIRECTORY-LOCAL INSTALL ~
104
115
105
116
You can install busted in your project’s directory by running the following
@@ -115,6 +126,9 @@ commands.
115
126
116
127
USER HOME DIRECTORY INSTALL ~
117
128
129
+
130
+ [!IMPORTANT] You need to set `local_luarocks_only` to `false` for
131
+ `neotest- busted` to find your home directory installation.
118
132
The following command will install busted in your home directory.
119
133
120
134
>shell
@@ -124,6 +138,9 @@ The following command will install busted in your home directory.
124
138
125
139
GLOBAL INSTALL ~
126
140
141
+
142
+ [!IMPORTANT] You need to set `local_luarocks_only` to `false` for
143
+ `neotest- busted` to find your global installation.
127
144
>shell
128
145
> luarocks install busted
129
146
<
@@ -141,22 +158,7 @@ run, the command will automatically try to find your tests in a `spec/`,
141
158
`test/` , or `tests/` directory.
142
159
143
160
>shell
144
- $ nvim -l ./scripts/test-runner.lua tests/my_spec.lua
145
- <
146
-
147
-
148
- TEST VIA ROCKSPEC
149
-
150
- If you use a rockspec, you can provide a test command so you can run tests
151
- using `luarocks test`.
152
-
153
- >lua
154
- -- Your rockspec...
155
-
156
- test = {
157
- type = "command",
158
- command = "nvim -u NONE -l ./scripts/test-runner.lua",
159
- }
161
+ $ nvim -l <path-to-neotest-busted> /scripts/test-runner.lua tests/my_spec.lua
160
162
<
161
163
162
164
@@ -186,6 +188,13 @@ Busted removed support for async testing in version 2
186
188
busted v1 but I haven’t tested that.
187
189
188
190
191
+ Q: WHY IS NEOTEST-BUSTED TESTED USING PLENARY?
192
+
193
+ The test could be run via `neotest- busted` itself but I decided to use plenary
194
+ instead to use another test runner so that bugs in `neotest- busted` won’t
195
+ affect its own tests.
196
+
197
+
189
198
INSPIRATION *neotest-busted-inspiration*
190
199
191
200
- Using Neovim as Lua interpreter with Luarocks <https://zignar.net/2023/01/21/using-luarocks-as-lua-interpreter-with-luarocks/ >
0 commit comments