nvim-neotest / neotest-go

MIT License
133 stars 43 forks source link

neotest-go adapter being used for typescript files when repo has both typescript and go #70

Open trevorwhitney opened 8 months ago

trevorwhitney commented 8 months ago

I have a few repos that have both typescript and go in them. I've noticed that when trying to run tests for the typescript code, the neotest-go adapter is being used.

Here's my config:

    require("neotest").setup({
        quickfix = {
            enabled = true,
        },
        log_level = vim.log.levels.DEBUG,
        adapters = {
            require("neotest-vim-test")({
                ignore_file_types = { "go" },
            }),

            require("neotest-go")({
                experimental = {
                    test_table = true,
                },
            }),
        },
    })

When I remove neotest-go, I'm able to run both typescript and go tests just fine using the neotest-vim-test adapter. However, I miss out on the table test functionality which is the whole thing that brought me to neotest in the first place. When I add neotest-go, running the same test yields the following debug message:

DEBUG | 2024-01-25T15:37:23Z-0700 | .../pack/packer/start/neotest/lua/neotest/adapters/init.lua:19 | Adapters: { {
    adapter = {
      _generate_position_id = <function 1>,
      build_spec = <function 2>,
      discover_positions = <function 3>,
      is_test_file = <function 4>,
      name = "neotest-go",
      prepare_results = <function 5>,
      results = <function 6>,
      root = <function 7>,
      <metatable> = {
        __call = <function 8>
      }
    },
    root = "/home/twhitney/workspace/some-typescript-repo"
  } }

The file I'm trying to run here is github.test.ts so there's no _test.go in the filename at all, but I'm assuming that since I have a go.mod at the root of this repo (as well as a package.json). the neotest-go adapter is trying to take over. Any way to work around this?

trevorwhitney commented 8 months ago

Upon further investigation, not sure if this bug belongs here or if this is a neotest bug?