Skip to content

[BUG] No tests found on neovim v0.12 #597

@dfalcone19

Description

@dfalcone19

NeoVim Version
v0.12.0

Describe the bug
In neovim v0.11.xx neotest had no issues finding tests. Upgraded to neovim v0.12.0 this morning, and in the same file neotest is unable to find any tests.

To Reproduce
Note: using vim.pack, unsure if this may contribute to the issue.

vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))

  vim.pack.add({
    "https://github.com/nvim-lua/plenary.nvim",
    "https://github.com/nvim-neotest/nvim-nio",
    "https://github.com/antoinemadec/FixCursorHold.nvim",
    { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
    "https://github.com/nvim-neotest/neotest-python",
    "https://github.com/nvim-neotest/neotest",
  })

  require("neotest").setup({
    adapters = {
      require("neotest-python"),
    },
  })

Steps to reproduce the behavior:

  1. Save the above as minimal.lua
  2. Create a test file test_example.py with a simple test:
  def test_hello():
      assert True
  1. Run nvim --clean -u minimal.lua test_example.py
  2. Run :lua require("neotest").run.run(vim.fn.expand("%"))
  3. No tests are found

Expected behavior
Tests to be found and run

Logs

ERROR | 2026-03-31T10:13:36Z-0400 | ...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:309 | Couldn't find positions in path /Users/name/company/backend/src/project/tests/common/test_format.py .../neovim/0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:236: attempt to call method 'start' (a nil value)
stack traceback:
        .../neovim/0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:236: in function 'get_node_text'
        ...ack/core/opt/neotest/lua/neotest/lib/treesitter/init.lua:29: in function 'build_position'
        ...ack/core/opt/neotest/lua/neotest/lib/treesitter/init.lua:66: in function 'collect'
        ...ack/core/opt/neotest/lua/neotest/lib/treesitter/init.lua:155: in function 'parse_positions_from_string'
        ...ack/core/opt/neotest/lua/neotest/lib/treesitter/init.lua:200: in function 'parse_positions'
        ...k/core/opt/neotest-python/lua/neotest-python/adapter.lua:68: in function 'discover_positions'
        ...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:300: in function <...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:264>
        [C]: in function 'xpcall'
        ...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:264: in function '_update_positions'
        ...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:317: in function <...m/site/pack/core/opt/neotest/lua/neotest/client/init.lua:315>

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions