allow gotestsum in watch mode

This commit is contained in:
ray-x 2022-10-01 15:03:26 +10:00
parent 5b33d782f3
commit 25f844684b
4 changed files with 6 additions and 2 deletions

View File

@ -216,6 +216,7 @@ first run of `GoFmt` may fail. It is recommended to run `GoInstallBinaries` to i
| GoStop {job_id} | `stop the job started with GoRun` |
| GoTest | go test ./... |
| GoTestSum {pkgname} | run gotestsum and show result in side panel |
| GoTestSum -w | run gotestsum in watch mode |
| GoTest -c | go test -c current_file_path |
| GoTest -n | test nearest, see GoTestFunc |
| GoTest -f | test current file, see GoTestFile |

View File

@ -104,7 +104,7 @@ _GO_NVIM_CFG = {
dap_port = 38697, -- can be set to a number or `-1` so go.nvim will pickup a random port
build_tags = "", --- you can provide extra build tags for tests or debugger
textobjects = true, -- treesitter binding for text objects
test_runner = "go", -- one of {`go`, `richgo`, `dlv`, `ginkgo`}
test_runner = "gotestsum", -- one of {`go`, `richgo`, `dlv`, `ginkgo`, `gotestsum`}
verbose_tests = true, -- set to add verbose flag to tests
run_in_floaterm = false, -- set to true to run in float window.
trouble = false, -- true: use trouble to open quickfix

View File

@ -173,6 +173,9 @@ return {
end, { complete = package.loaded.go.package_complete, nargs = '*' })
create_cmd('GoTestSum', function(opts)
if opts.fargs[1] == '-w' then
return require('go.gotestsum').watch()
end
require('go.gotestsum').run(unpack(opts.fargs))
end, { complete = package.loaded.go.package_complete, nargs = '*' })

View File

@ -33,7 +33,7 @@ local show_panel = function()
vim.notify('guihua not installed')
return
end
if test_panel == nil then
if test_panel == nil or not test_panel:is_open() then
test_panel = panel:new({
header = '   go test  ',
render = function(buf)