It requires nvim-treesitter
Make sure you have the bash parser installed. Use
:TSInstall bash
Plug 'rcasia/neotest-bash'NOTE: this plugin depends on the
bashunitbinary to work.
require("neotest").setup({
adapters = {
require("neotest-bash")
}
})You can optionally supply configuration settings:
require("neotest").setup({
adapters = {
require("neotest-bash")({
-- Custom bashunit path for the runner.
-- Can be a string (absolute or relative to repo root/cwd).
-- If not provided, the path will be inferred by checking for
-- lib/bashunit in your repo root/cwd, or for bashunit on the $PATH
executable = "path/to/bashunit/executable",
-- Additional CLI arguments passed to bashunit on every run.
-- Useful for enabling coverage or other flags.
args = {},
})
}
})Use the args option to pass additional CLI flags to bashunit. For example, to enable coverage reporting:
require("neotest").setup({
adapters = {
require("neotest-bash")({
args = {
"--coverage",
"--coverage-paths", "bin",
"--coverage-report", vim.fn.getcwd() .. "/coverage/lcov.info",
},
})
}
})You can also pass one-off arguments via neotest's extra_args when running tests:
require("neotest").run.run({ extra_args = { "--report-coverage" } })Arguments from both args (config) and extra_args (per-run) are merged together.
