Skip to content

Commit

Permalink
feat(nvim-coverage): add keybindings (#1186)
Browse files Browse the repository at this point in the history
* feat(nvim-coverage): add keybindings

* feat(nvim-coverage): auto reload the coverage report
  • Loading branch information
cristobalgvera authored Sep 3, 2024
1 parent bfbbe67 commit 07ff0d8
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions lua/astrocommunity/test/nvim-coverage/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
---@type LazySpec
return {
"andythigpen/nvim-coverage",
event = "User AstroFile",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {},
opts = {
auto_reload = true,
},
dependencies = {
"nvim-lua/plenary.nvim",
{
"AstroNvim/astroui",
opts = {
icons = {
Tests = "󰗇",
Coverage = "",
},
},
},
{
"AstroNvim/astrocore",
optional = true,
opts = function(_, opts)
local astroui = require "astroui"
local maps = opts.mappings

local tests_prefix = "<Leader>T"
local coverage_prefix = tests_prefix .. "C"

-- INFO: Compatibility with `neotest` and `vim-test`
maps.n[tests_prefix] = { desc = astroui.get_icon("Tests", 1, true) .. "Tests" }

maps.n[coverage_prefix] = { desc = astroui.get_icon("Coverage", 1, true) .. "Coverage" }
maps.n[coverage_prefix .. "t"] = { function() require("coverage").toggle() end, desc = "Toggle coverage" }
maps.n[coverage_prefix .. "s"] =
{ function() require("coverage").summary() end, desc = "Show coverage summary" }
maps.n[coverage_prefix .. "c"] = { function() require("coverage").clear() end, desc = "Clear coverage" }
maps.n[coverage_prefix .. "l"] = {
function() require("coverage").load(true) end,
desc = "Load and show coverage",
}
end,
},
},
}

0 comments on commit 07ff0d8

Please sign in to comment.