Running test suite doesn't work
fredrikaverpil opened this issue · comments
The readme states that you can run the full test suite with require('neotest').run.run(vim.fn.getcwd())
if your project root (with go.mod/go.sum in its root) is the current working directory.
Reproduce
- Clone down this repo: https://github.com/fredrikaverpil/go-playground
cd lwgt
- Start neovim:
nvim
. - Open test summary:
:lua require("neotest").summary.open()
- Run
:lua require('neotest').run.run(vim.fn.getcwd())
- See how no tests are being run. If checking the
:Neotest output-panel
, it saysno Go files in /Users/fredrik/code/public/go-playground/lgwt
.
For some other projects, I get a different error in the output, like e.g. package github.com/uuu/xxx/yyy: build constraints exclude all Go files in /Users/fredrik/code/work/private/xxx/yyy
.
Workaround
If you add a dummy test file in the root of the project, the tests look like they all execute (in e.g. the test summary), but they actually don't execute.
// dummy test file: t_test.go
package main
import "testing"
func TestDummy(*testing.T) {
}
If you also pass recursive_run = true
as option to neotest-go, tests will execute.
require("neotest").setup({
adapters = {
require("neotest-go")({
recursive_run = true
})
}
})