Skip to content

rcasia/neotest-bash

Repository files navigation

neotest-bash

Neotest adapter for Bash, using bashunit

image

🔧 Installation

It requires nvim-treesitter

Make sure you have the bash parser installed. Use :TSInstall bash

vim-plug

Plug 'rcasia/neotest-bash'

NOTE: this plugin depends on the bashunit binary to work.

⚙ Configuration

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 = {},
    })
  }
})

Passing extra arguments

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.

About

Neotest adapter for Bash.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors