feat: verbose tests toggle (#123)

Co-authored-by: Ales Brelih <ales.brelih@3fs.si>
pull/125/head
Aleš Brelih 2 years ago committed by GitHub
parent 5c4fcc49ac
commit 6d2062c3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -503,6 +503,7 @@ require('go').setup({
build_tags = "tag1,tag2", -- set default build tags
textobjects = true, -- enable default text jobects through treesittter-text-objects
test_runner = 'go', -- richgo, go test, richgo, dlv, ginkgo
verbose_tests = true, -- set to add verbose flag to tests
run_in_floaterm = false, -- set to true to run in float window. :GoTermClose closes the floatterm
-- float term recommand if you use richgo/ginkgo with terminal color
})

@ -312,6 +312,7 @@ You can setup go.nvim with following options:
gopls_cmd = nil, --- you can provide gopls path and cmd if it not in PATH, e.g. cmd = { "/home/ray/.local/nvim/data/lspinstall/go/gopls" }
build_tags = "", --- you can provide extra build tags for tests or debugger
test_runner = "go", -- richgo, go test, richgo, dlv, ginkgo
verbose_tests = true, -- set to add verbose flag to tests
run_in_floaterm = false, -- set to true to run in float window.
}

@ -50,6 +50,7 @@ _GO_NVIM_CFG = {
build_tags = "", --- you can provide extra build tags for tests or debugger
textobjects = true, -- treesitter binding for text objects
test_runner = "go", -- richgo, go test, richgo, dlv, ginkgo
verbose_tests = true, -- set to add verbose flag to tests
run_in_floaterm = false, -- set to true to run in float window.
}

@ -94,12 +94,16 @@ local function run_test(path, args)
local tags = get_build_tags(args)
log(tags)
local cmd
local cmd = {}
if _GO_NVIM_CFG.run_in_floaterm then
cmd = { test_runner, "test", "-v" }
else
cmd = { "-v" }
table.insert(cmd, test_runner)
table.insert(cmd, "test")
end
if _GO_NVIM_CFG.verbose_tests then
table.insert(cmd, "-v")
end
if not empty(tags) then
cmd = vim.list_extend(cmd, tags)
end
@ -210,13 +214,17 @@ M.test_fun = function(...)
end
end
local cmd
local cmd = {}
local run_in_floaterm = optarg["F"] or _GO_NVIM_CFG.run_in_floaterm
if run_in_floaterm then
cmd = { test_runner, "test", "-v" }
else
cmd = { "-v" }
table.insert(cmd, test_runner)
table.insert(cmd, "test")
end
if _GO_NVIM_CFG.verbose_tests then
table.insert("-v")
end
if not empty(tags) then
cmd = vim.list_extend(cmd, tags)
end
@ -286,13 +294,16 @@ M.test_file = function(...)
local relpath = utils.rel_path()
local cmd_args
local cmd_args = {}
if run_in_floaterm then
cmd_args = { test_runner, "test", "-v" }
else
cmd_args = { "-v" }
table.insert(cmd_args, test_runner)
table.insert(cmd_args, "test")
end
if _GO_NVIM_CFG.verbose_tests then
table.insert(cmd_args, "-v")
end
if tags ~= nil and #tags > 1 then
cmd_args = vim.list_extend(cmd_args, tags)
end

@ -41,6 +41,7 @@ require('go').setup({
dap_debug_vt = true, -- set to true to enable dap virtual text
test_runner = 'richgo', -- richgo, go test, richgo, dlv, ginkgo
verbose_tests = true, -- set to add verbose flag to tests
run_in_floaterm = true -- set to true to run in float window.
})
EOF

Loading…
Cancel
Save