Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

nvim-contrib/neotest-ginkgo

Open more actions menu

Repository files navigation

neotest-ginkgo

Neotest adapter for running Ginkgo v2 tests in Neovim. Run, debug, and inspect your Go BDD specs directly from the editor — with full support for nested Describe/Context/When/It hierarchies, DescribeTable/Entry, and DAP debugging via nvim-dap-go.

test Release License Neovim Neotest

neotest-ginkgo demo

Features

  • Run individual specs, describe blocks, or entire suites
  • Full Ginkgo v2 support: Describe, Context, It, When, Specify, DescribeTable, DescribeTableSubtree, and Entry
  • Focus (FDescribe, FIt) and pending (PDescribe, PIt, XIt) variants
  • Nested test hierarchy displayed in the Neotest summary tree
  • DAP integration for step-through debugging of individual specs
  • Structured output panel with color-coded test results
  • Works with lazy.nvim, packer.nvim, and any other plugin manager

Requirements

Installation

lazy.nvim

{
  "nvim-neotest/neotest",
  lazy = true,
  dependencies = {
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "nvim-treesitter/nvim-treesitter",
    "nvim-contrib/neotest-ginkgo",
  },
  config = function()
    require("neotest").setup({
      adapters = {
        require("neotest-ginkgo"),
      },
    })
  end,
}

packer.nvim

use {
  "nvim-neotest/neotest",
  requires = {
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "nvim-treesitter/nvim-treesitter",
    "nvim-contrib/neotest-ginkgo",
  },
  config = function()
    require("neotest").setup({
      adapters = {
        require("neotest-ginkgo"),
      },
    })
  end,
}

Configuration

You can customize the Ginkgo command and DAP arguments via setup():

require("neotest-ginkgo").setup({
  -- Base ginkgo command (default: {"ginkgo", "run", "-v"})
  command = { "ginkgo", "run", "-v", "--race" },
  -- DAP arguments with --ginkgo. prefix (default: {"--ginkgo.v"})
  dap = { "--ginkgo.v", "--ginkgo.trace" },
})

Usage

Use the standard Neotest keybindings to run tests. Example setup:

vim.keymap.set("n", "<leader>tt", function() require("neotest").run.run() end, { desc = "Run nearest test" })
vim.keymap.set("n", "<leader>tf", function() require("neotest").run.run(vim.fn.expand("%")) end, { desc = "Run file" })
vim.keymap.set("n", "<leader>ts", function() require("neotest").summary.toggle() end, { desc = "Toggle summary" })
vim.keymap.set("n", "<leader>to", function() require("neotest").output_panel.toggle() end, { desc = "Toggle output" })
vim.keymap.set("n", "<leader>td", function() require("neotest").run.run({ strategy = "dap" }) end, { desc = "Debug nearest test" })

Contributing

Contributions are welcome! Please open an issue or pull request.

To set up a development environment with Nix:

nix develop
make test

Without Nix, update tests/setup.lua with the paths to your local plugin installations, then:

make test

License

MIT

Morty Proxy This is a proxified and sanitized view of the page, visit original site.