neovim plugin for easy test file opening
- Open tests for the current buffer
- Open source for the buffer
local rekt = require("rekt")
rekt.setup()
The default behavior is to open new buffers vertically
{
open = "vertical",
filetypes = {
go = { suffix = "_test", },
js = { suffix = ".spec", },
lua = { suffix = ".test", source_root = "lua", test_root = "test" },
ts = { suffix = ".spec", },
tsx = { suffix = ".spec", }
},
}
Controls how to open the file
buffer
: opens in a new bufferhorizontal
: opens in a new horizontal splitvertical
: opens in a new vertical split
Filetype configuration.
suffix
how to specify test. The separator is important (.
,_
,-
)source_root
optional field useful for when the test and source files are stored separatelytest_root
optional field useful for when the test and source files are stored separately
NOTE: if either source_root
or test_root
is defined, the other must also
be defined. This is for opening files that haven't been created yet.
rekt.open_test_file()
Based on the file in the current buffer, find a test file that matches the name.
You may optionally pass in a from_path
which will be the starting path to
begin the search. If no from_path
is provided, it will default to the
directory of the file in the buffer.
rekt.open_source_file()
Based on the file in the current buffer, find a source file that maches the
name. You may optionally pass in a from_path
which will be the starting path
to begin the search. If no from_path
is provided, it will default to the
directory of the file in the buffer.