Skip to content

Commit

Permalink
feat(test): add vim-test (#1112)
Browse files Browse the repository at this point in the history
* feat(test): add vim-test

* fix(test): vim-test options

* feat(test): add type annotation and nil safety

* fix(test): remove wrapping {}
  • Loading branch information
ALameLlama authored Jul 19, 2024
1 parent 71f26b6 commit 4e33ed3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/astrocommunity/test/vim-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# vim-test

Run your tests at the speed of thought

**Repository:** <https://github.com/vim-test/vim-test>
32 changes: 32 additions & 0 deletions lua/astrocommunity/test/vim-test/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---@type LazySpec
return {
"vim-test/vim-test",
cmd = { "TestNearest", "TestFile", "TestLast", "TestClass", "TestSuite", "TestVisit" },
dependencies = {
{
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
opts = function(_, opts)
local maps = assert(opts.mappings)

local prefix = "<Leader>T"
maps.n[prefix] = { desc = require("astroui").get_icon("VimTest", 1, true) .. "Testing" }

maps.n[prefix .. "n"] = { ":TestNearest<CR>", desc = "Test Nearest" }
maps.n[prefix .. "f"] = { ":TestFile<CR>", desc = "Test File" }
maps.n[prefix .. "l"] = { ":TestLast<CR>", desc = "Test Last" }
maps.n[prefix .. "c"] = { ":TestClass<CR>", desc = "Test Class" }
maps.n[prefix .. "s"] = { ":TestSuite<CR>", desc = "Test Suite" }
maps.n[prefix .. "v"] = { ":TestVisit<CR>", desc = "Test Visit" }

-- Set the strategy to open results in a vertical split
if not opts.options then opts.options = {} end
if not opts.options.g then opts.options.g = {} end
opts.options.g["test#strategy"] = "neovim"
opts.options.g["test#neovim#term_position"] = "vert"
end,
},
{ "AstroNvim/astroui", opts = { icons = { VimTest = "󰙨" } } },
},
event = { "VeryLazy" },
}

0 comments on commit 4e33ed3

Please sign in to comment.