Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: getting no output when testing whole file #283

Open
5 tasks done
fredrikaverpil opened this issue Feb 6, 2025 · 0 comments
Open
5 tasks done

bug: getting no output when testing whole file #283

fredrikaverpil opened this issue Feb 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@fredrikaverpil
Copy link
Owner

Discussed in #282

Originally posted by jamiel February 6, 2025

Did you check docs and existing issues?

  • I have read the documentation.
  • I have searched the existing configuration related discussions.
  • I have updated to the latest version of Neotest.
  • I have updated to the latest version of neotest-golang.
  • I have checked the Neotest log for errors (see README for instructions on enabling it).

Neovim version (nvim -v)

0.10.3

Operating system/version

Gentoo Linux 6.12.7

Output from :checkhealth neotest-golang

neotest-golang: require("neotest-golang.health").check()

Requirements ~
- OK Binary 'go' found on PATH: /usr/bin/go
- OK Found go.mod file for /home/jamie/Development/playground/go/learn-go-with-tests/arrays-and-slices/main_test.go in /home/jamie/Development/playground/go/learn-go-with-tests/arrays-and-slices/go.mod
- OK Treesitter parser for go is installed
- OK neotest is available
- OK nvim-treesitter is available
- OK nio is available
- OK plenary is available

DAP (optional) ~
- OK Binary 'dlv' found on PATH: /usr/bin/dlv
- WARNING dap is not available
- WARNING dapui is not available
- WARNING dap-go is not available

Gotestsum (optional) ~
- OK Binary 'gotestsum' found on PATH: /home/jamie/go/bin/gotestsum
- Found gotestsum to be installed, but not set as test runner.

Sanitization (optional) ~
- OK Sanitization is disabled

Your Neotest and neotest-golang Lua setup

require("neotest").setup({
  adapters = {
    require("neotest-golang")({log_level = vim.log.levels.DEBUG}),
  },
})

-- run all tests in file and display output panel
vim.keymap.set('n', 'tf', function()
  require("neotest").run.run(vim.fn.expand("%"))
  require("neotest").output_panel.open()
end, { desc = "Run all tests in file" })

Describe the problem

When running individual tests, I get the result of the the test in the output panel. However, when running all tests in the file, I do not get the outcome of the tests although the tests pass and I get the inline display showing passed within the test file.

Output where first set is running each test one by one and final output running all tests:

2025-02-06-101707_1146x2016_scrot

Debug shows successful output too:

DEBUG | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | Searching for go.mod in /home/jamie/Development/playground/go/neotest-bug
INFO | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:82 | Found go.mod at /home/jamie/Development/playground/go/neotest-bug/go.mod
INFO | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:82 | Running Go list: go list -f {
    "Dir": {{printf "%q" .Dir}},
    "ImportPath": "{{.ImportPath}}",
    "Name": "{{.Name}}",
    "TestGoFiles": [{{range $i, $f := .TestGoFiles}}{{if ne $i 0}},{{end}}"{{$f}}"{{end}}],
    "XTestGoFiles": [{{range $i, $f := .XTestGoFiles}}{{if ne $i 0}},{{end}}"{{$f}}"{{end}}],
    "Module": { "GoMod": {{printf "%q" .Module.GoMod}} }
    } ./... in /home/jamie/Development/playground/go/neotest-bug
DEBUG | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | JSON-decoded 'go list' output:  { {
    Dir = "/home/jamie/Development/playground/go/neotest-bug",
    ImportPath = "neotest-bug",
    Module = {
      GoMod = "/home/jamie/Development/playground/go/neotest-bug/go.mod"
    },
    Name = "main",
    TestGoFiles = {},
    XTestGoFiles = { "main_test.go" }
  } }
INFO | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:82 | Test command: go test -json -v -race -count=1 neotest-bug -run ^(^TestAdd$|^TestSub$)$
DEBUG | 2025-02-06T10:16:54Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | RunSpec: {
  command = { "go", "test", "-json", "-v", "-race", "-count=1", "neotest-bug", "-run", "^(^TestAdd$|^TestSub$)$" },
  context = {
    golist_data = { {
        Dir = "/home/jamie/Development/playground/go/neotest-bug",
        ImportPath = "neotest-bug",
        Module = {
          GoMod = "/home/jamie/Development/playground/go/neotest-bug/go.mod"
        },
        Name = "main",
        TestGoFiles = {},
        XTestGoFiles = { "main_test.go" }
      } },
    pos_id = "/home/jamie/Development/playground/go/neotest-bug/main_test.go"
  },
  cwd = "/home/jamie/Development/playground/go/neotest-bug"
}
DEBUG | 2025-02-06T10:16:55Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | Runner 'go', raw output:  { '{"Time":"2025-02-06T10:16:54.664187531Z","Action":"start","Package":"neotest-bug"}', '{"Time":"2025-02-06T10:16:54.671044982Z","Action":"run","Package":"neotest-bug","Test":"TestAdd"}', '{"Time":"2025-02-06T10:16:54.671056875Z","Action":"output","Package":"neotest-bug","Test":"TestAdd","Output":"=== RUN   TestAdd\\n"}', '{"Time":"2025-02-06T10:16:54.671103283Z","Action":"output","Package":"neotest-bug","Test":"TestAdd","Output":"--- PASS: TestAdd (0.00s)\\n"}', '{"Time":"2025-02-06T10:16:54.671130374Z","Action":"pass","Package":"neotest-bug","Test":"TestAdd","Elapsed":0}', '{"Time":"2025-02-06T10:16:54.671135544Z","Action":"run","Package":"neotest-bug","Test":"TestSub"}', '{"Time":"2025-02-06T10:16:54.671138329Z","Action":"output","Package":"neotest-bug","Test":"TestSub","Output":"=== RUN   TestSub\\n"}', '{"Time":"2025-02-06T10:16:54.671168196Z","Action":"output","Package":"neotest-bug","Test":"TestSub","Output":"--- PASS: TestSub (0.00s)\\n"}', '{"Time":"2025-02-06T10:16:54.671194906Z","Action":"pass","Package":"neotest-bug","Test":"TestSub","Elapsed":0}', '{"Time":"2025-02-06T10:16:54.671198633Z","Action":"output","Package":"neotest-bug","Output":"PASS\\n"}', '{"Time":"2025-02-06T10:16:55.672895918Z","Action":"output","Package":"neotest-bug","Output":"ok  \\tneotest-bug\\t1.009s\\n"}', '{"Time":"2025-02-06T10:16:55.6729283Z","Action":"pass","Package":"neotest-bug","Elapsed":1.009}' }
DEBUG | 2025-02-06T10:16:55Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | Final internal test result data {
  ["/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestAdd"] = {
    duplicate_test_detected = false,
    errors = {},
    gotest_data = {
      name = "TestAdd",
      output = { "=== RUN   TestAdd\n" },
      pkg = "neotest-bug"
    },
    neotest_data = {
      id = "/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestAdd",
      name = "TestAdd",
      path = "/home/jamie/Development/playground/go/neotest-bug/main_test.go",
      range = { 6, 0, 10, 1 },
      type = "test"
    },
    status = "passed"
  },
  ["/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestSub"] = {
    duplicate_test_detected = false,
    errors = {},
    gotest_data = {
      name = "TestSub",
      output = { "=== RUN   TestSub\n" },
      pkg = "neotest-bug"
    },
    neotest_data = {
      id = "/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestSub",
      name = "TestSub",
      path = "/home/jamie/Development/playground/go/neotest-bug/main_test.go",
      range = { 12, 0, 16, 1 },
      type = "test"
    },
    status = "passed"
  }
}
DEBUG | 2025-02-06T10:16:55Z+0000 | ...im/plugged/neotest-golang/lua/neotest-golang/logging.lua:70 | Final Neotest result data {
  ["/home/jamie/Development/playground/go/neotest-bug/main_test.go"] = {
    output = "/tmp/nvim.jamie/ZaF4Kq/11",
    status = "passed"
  },
  ["/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestAdd"] = {
    errors = {},
    output = "/tmp/nvim.jamie/ZaF4Kq/9",
    status = "passed"
  },
  ["/home/jamie/Development/playground/go/neotest-bug/main_test.go::TestSub"] = {
    errors = {},
    output = "/tmp/nvim.jamie/ZaF4Kq/10",
    status = "passed"
  }
}
```</div>
@fredrikaverpil fredrikaverpil added the bug Something isn't working label Feb 6, 2025
@fredrikaverpil fredrikaverpil changed the title Getting no output when testing whole file bug: getting no output when testing whole file Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant