-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
neotest.txt
358 lines (254 loc) · 10.8 KB
/
neotest.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
================================================================================
*neotest*
A framework to interact with tests within NeoVim.
There are three main components to this plugin's architecture.
- Adapters: Generally language specific objects to parse tests, build commands
and parse results
- Client: Runs tests and stores state of tests and results, emitting events
during operation
- Consumers: Use the client to provide some utility to interact with tests and
results
In order to use neotest, you must use an adapter for your language of choice.
You can supply them in the setup function.
Once you have setup an adapter, you can use neotest consumers to run and
interact with tests. For most users, the bulk of relevant features will be in
the consumers. There are multiple consumers:
- run: Allows running, debugging and stopping tests.
- summary: Shows all known tests in a tree structure, along with their current
state.
- output: Displays the output of tests.
- diagnostics: Uses vim.diagnostic to show error messages where they occur (if
supported by the adapter).
- status: Displays signs beside tests and namespaces to show current result
state.
Each consumer can be accessed as a property of the neotest module
>
require("neotest").summary.toggle()
<
neotest.setup({user_config}) *neotest.setup()*
Configure Neotest strategies and consumers
See: ~
|neotest.Config|
Default values:
{
adapters = {},
diagnostic = {
enabled = true
},
floating = {
border = "rounded",
max_height = 0.6,
max_width = 0.6
},
highlights = {
adapter_name = "NeotestAdapterName",
border = "NeotestBorder",
dir = "NeotestDir",
expand_marker = "NeotestExpandMarker",
failed = "NeotestFailed",
file = "NeotestFile",
focused = "NeotestFocused",
indent = "NeotestIndent",
namespace = "NeotestNamespace",
passed = "NeotestPassed",
running = "NeotestRunning",
skipped = "NeotestSkipped",
test = "NeotestTest"
},
icons = {
child_indent = "│",
child_prefix = "├",
collapsed = "─",
expanded = "╮",
failed = "✖",
final_child_indent = " ",
final_child_prefix = "╰",
non_collapsible = "─",
passed = "✔",
running = "🗘",
skipped = "ﰸ",
unknown = "?"
},
output = {
enabled = true,
open_on_run = "short"
},
run = {
enabled = true
},
status = {
enabled = true
},
strategies = {
integrated = {
height = 40,
width = 120
}
},
summary = {
enabled = true,
expand_errors = true,
follow = true,
mappings = {
attach = "a",
expand = { "<CR>", "<2-LeftMouse>" },
expand_all = "e",
jumpto = "i",
output = "o",
run = "r",
short = "O",
stop = "u"
}
}
}
Parameters: ~
{user_config} (neotest.Config)
================================================================================
*neotest.config*
neotest.Config *neotest.Config*
Fields: ~
{adapters} (neotest.Adapter[])
{icons} (table<string, string>)
{highlights} (table<string, string>)
{floating} (neotest.Config.floating)
{strategies} (neotest.Config.strategies)
{summary} (neotest.Config.summary)
{output} (neotest.Config.output)
neotest.Config.floating *neotest.Config.floating*
Fields: ~
{border} (string) Border style
{max_height} (number) Max height of window as proportion of NeoVim
window
{max_width} (number) Max width of window as proportion of NeoVim
window
neotest.Config.strategies.integrated *neotest.Config.strategies.integrated*
Fields: ~
{width} (integer) Width to pass to the pty runnning commands
neotest.Config.strategies *neotest.Config.strategies*
Fields: ~
{integrated} (neotest.Config.strategies.integrated)
neotest.Config.summary *neotest.Config.summary*
Fields: ~
{enabled} (boolean)
{follow} (boolean) Expand user's
current file
{expand_errors} (boolean) Expand all failed
positions
{mappings} (neotest.Config.summary.mappings) Buffer mappings for
summary window
neotest.Config.summary.mappings *neotest.Config.summary.mappings*
Fields: ~
{expand} (string|string[]) Expand currently selected position
{expand_all} (string|string[]) Expand all positions under currently
selected
{output} (string|string[]) Show output for position
{short} (string|string[]) Show short output for position (if
exists)
{attach} (string|string[]) Attach to process for position
{jumpto} (string|string[]) Jump to the selected position
{stop} (string|string[]) Stop selected position
{run} (string|string[]) Run selected position
neotest.Config.output *neotest.Config.output*
Fields: ~
{enabled} (boolean)
{open_on_run} (boolean) Open nearest test result after running
neotest.Config.diagnostic *neotest.Config.diagnostic*
Fields: ~
{enabled} (boolean)
neotest.Config.status *neotest.Config.status*
Fields: ~
{enabled} (boolean)
================================================================================
*neotest.output*
A consumer that displays the output of test results.
neotest.output.open({opts}) *neotest.output.open()*
Open the output of a test result
>
lua require("neotest").open({ enter = true })
<
Parameters: ~
{opts} (table)
Fields: ~
{short} (boolean) Show shortened output
{enter} (boolean) Enter output window
{position_id} (string) Open output for position with this ID, opens
nearest position if not given
{adapter} (string) Adapter ID, defaults to first found with
matching position
================================================================================
*neotest.run*
A consumer providing a simple interface to run tests.
neotest.run.run({args}) *neotest.run.run()*
Run the given position or the nearest position if not given. All arguments
are optional
Run the current file
>
lua require("neotest").run(vim.fn.expand("%"))
<
Run the nearest test
>
lua require("neotest").run()
<
Debug the current file with nvim-dap
>
lua require("neotest").run({vim.fn.expand("%"), strategy = "dap"})
<
Parameters: ~
{args} (string|table) Position ID to run or args. If args then
args[1] should be the position ID.
Fields: ~
{adapter} (string) Adapter ID, if not given the
first adapter found with
chosen position is used.
{strategy} (string|neotest.Strategy) Strategy to run commands with
{extra_args} (string[]) Extra arguments for test
command
neotest.run.stop({args}) *neotest.run.stop()*
Stop a running process
Parameters: ~
{args} (string|table) Position ID to stop or args. If args then
args[1] should be the position ID.
Fields: ~
{adapter} (string) Adapter ID, if not given the first adapter found
with chosen position is used.
neotest.run.attach({args}) *neotest.run.attach()*
Attach to a running process for the given position.
Parameters: ~
{args} (string|table) Position ID to attach to or args. If args then
args[1] should be the position ID.
Fields: ~
{adapter} (string) Adapter ID, if not given the first adapter found
with chosen position is used.
================================================================================
*neotest.status*
A consumer that displays the results of tests as signs beside their
declaration. This consumer is completely passive and so has no interface.
================================================================================
*neotest.diagnostic*
A consumer that displays error messages using the vim.diagnostic API. This
consumer is completely passive and so has no interface.
You can configure the diagnostic API for neotest using the "neotest" namespace
See: ~
|vim.diagnostic.config()|
================================================================================
*neotest.summary*
A consumer that displays the structure of the test suite, along with results
and allows running tests.
See: ~
|neotest.Config.summary.mappings| for all mappings in the summary window
neotest.summary.open() *neotest.summary.open()*
Open the summary window
>
lua require("neotest").summary.open()
<
neotest.summary.close() *neotest.summary.close()*
Close the summary window
>
lua require("neotest").summary.close()
<
neotest.summary.toggle() *neotest.summary.toggle()*
Toggle the summary window
>
lua require("neotest").summary.toggle()
<
vim:tw=78:ts=8:ft=help:norl: