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] CMD Neotest Summary freezes Neovim #441

Open
b0lle opened this issue Jul 21, 2024 · 9 comments
Open

[BUG] CMD Neotest Summary freezes Neovim #441

b0lle opened this issue Jul 21, 2024 · 9 comments
Assignees

Comments

@b0lle
Copy link

b0lle commented Jul 21, 2024

NeoVim Version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info

Describe the bug
In 90% of my cases, the execution of the Neotest Summary command freezes my Neovim. There is no option to quit neovim anymore.

To Reproduce
Sorry I can not provide a minimal example, because sometimes it works just fine ...

My neotest-config:

return {
  'nvim-neotest/neotest',
  dependencies = {
    'nvim-neotest/nvim-nio',
    'nvim-lua/plenary.nvim',
    'antoinemadec/FixCursorHold.nvim',
    'nvim-treesitter/nvim-treesitter',
  },
  config = function()
    require('neotest').setup {
      adapters = {
        require 'neotest-python' {
          dap = { justMyCode = false },
          args = { '-vv', '-s' },
          runner = 'pytest',
        },
      },
    }
  end,
  keys = {
    { '<leader>ta', "<cmd>lua require('neotest').run.run(vim.fn.getcwd())<cr>", desc = '[T]est [a]ll' },
    { '<leader>tf', "<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<cr>", desc = '[T]est current [f]ile' },
    { '<leader>tn', "<cmd>lua require('neotest').run.run()<cr>", desc = '[T]est nearest test' },
    { '<leader>tx', "<cmd>lua require('neotest').run.stop()<cr>", desc = 'Stop test' },
    { '<leader>tl', "<cmd>lua require('neotest').run.run_last()<cr>", desc = 'Run last test' },
    { '<leader>tdn', "<cmd>lua require('neotest').run.run({strategy = 'dap'})<cr>", desc = '[T]est debug nearest test' },
    { '<leader>ts', "<cmd>lua require('neotest').summary.toggle({ enter = true })<cr>", desc = 'toggle summary' },
    { '<leader>to', "<cmd>lua require('neotest').output_panel.toggle()<cr>", desc = 'toggle output panel' },
  },
}

Steps to reproduce the behavior:
lua require('neotest').summary.toggle({ enter = true })

Logs
Log of a failed run. It seems that somehow the connection to the child process could not be established.

INFO | 2024-07-21T14:52:35Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:33 | Starting child process
INFO | 2024-07-21T14:52:35Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:36 | Parent address: localhost:64986
INFO | 2024-07-21T14:52:35Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:42 | Starting child process with command: /opt/homebrew/Cellar/neovim/0.10.0/bin/nvim --embed --headless -n

here is a log file of a successful run:

INFO | 2024-07-21T14:50:32Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:33 | Starting child process
INFO | 2024-07-21T14:50:32Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:36 | Parent address: localhost:64927
INFO | 2024-07-21T14:50:32Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:42 | Starting child process with command: /opt/homebrew/Cellar/neovim/0.10.0/bin/nvim --embed --headless -n
ERROR | 2024-07-21T14:50:33Z+0200 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:57 | Child process is waiting for input at startup. Aborting.
INFO | 2024-07-21T14:50:33Z+0200 | ...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:378 | Initialising client
INFO | 2024-07-21T14:50:33Z+0200 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:48 | Emitting starting event
DEBUG | 2024-07-21T14:50:33Z+0200 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event starting
INFO | 2024-07-21T14:50:33Z+0200 | ...al/share/nvim/lazy/neotest/lua/neotest/adapters/init.lua:18 | Found 1 adapters for directory /Users/xxx/Code/xxx/main
DEBUG | 2024-07-21T14:50:33Z+0200 | ...al/share/nvim/lazy/neotest/lua/neotest/adapters/init.lua:19 | Adapters: { {
    adapter = {
      build_spec = <function 1>,
      discover_positions = <function 2>,
      filter_dir = <function 3>,
      is_test_file = <function 4>,
      name = "neotest-python",
      results = <function 5>,
      root = <function 6>,
      <metatable> = {
        __call = <function 7>
      }
    },
    root = "/Users/xxx/xxx/main"
  } }
INFO | 2024-07-21T14:50:33Z+0200 | ...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:279 | Searching /Users/xxx/Code/xxx/main for test files
...

Additional context
neotest-python 0.07ms  start
dir /Users/julianfrenzel/.local/share/nvim/lazy/neotest-python
url https://github.com/nvim-neotest/neotest-python
branch master
commit 2e83d2b
readme README.md

neotest  ts  to  ta  tf  tn  tx  tl  tdn
dir /Users/julianfrenzel/.local/share/nvim/lazy/neotest
url https://github.com/nvim-neotest/neotest
version 5.4.0
tag v5.4.0
branch master
commit 32ff2ac
readme README.md
help |neotest.txt|

@chuan2984
Copy link

i have the same problem, in fact, i have been having this problem since I installed neotest. As much as I like using it, i just had to disable it this week because of the amount of restarts that i have to do since it just hangs. Sometimes you can quit by repeatedly hitting ctrl+c, and im usually presented with some error message pointing to nio

@trobrock
Copy link

@chuan2984 I'm having the same issue, it freezes a few times daily.

@chuan2984
Copy link

@trobrock i havent bothered digging into it. I could do a git bisect or start fresh to see if its a compatibility issue, but i have not bothered. I mainly run my tests inside docker, the only parts that I find myself missing are: test treeview, and the ability to run a test where my cursor is at. Im just planning on writing a small script that would use wezterm to split the pane and run some bash commands to get the test result for accomplishing the test running part which might just suffice.

@PiotrRaszkowski
Copy link

Same problem from my side, freezes for couple of seconds or minutes.

@fredrikaverpil
Copy link
Contributor

fredrikaverpil commented Oct 19, 2024

Lots of users do not experience this issue. I for one do not experience this (and I'm on macOS too, just like OP). I often spend several hours a day with the test summary opened.

To increase the chance of someone taking the time to investigate, being able to reproduce, connect the dots, and find the root cause, please provide as much details you can.

For example, please provide your Neovim version, if you're using a distro (like LazyVim) and any version, Neotest version, the adapter(s) you are using and their versions and your OS version. If it feels really difficult to find a common denominator, add even more information such as the shell and type of terminal you are using.

So far it's difficult to detect a pattern between the reporters above as no information was provided on their setup (except from OPs setup).

@PiotrRaszkowski
Copy link

I understand that the problem is that neotest does a lot in the background - for example when I open the toggle panel in my big multi-module project it discovers all the tests I have - almost 5000. It takes some time... and requires ram and cpu resources.

@fredrikaverpil
Copy link
Contributor

fredrikaverpil commented Oct 19, 2024

I understand that the problem is that neotest does a lot in the background - for example when I open the toggle panel in my big multi-module project it discovers all the tests I have - almost 5000. It takes some time... and requires ram and cpu resources.

Perhaps this (:h neotest.Config) can be useful if it's a performance issue: https://github.com/fredrikaverpil/neotest-golang#neotest-is-slowing-down-neovim

@PiotrRaszkowski
Copy link

@fredrikaverpil Those options helped a lot, massive performance boost.
I found one more thing. I used Tabby terminal, when I switched to Warp it is also much more fast. For example I needed to remove lualine plugin in Tabby, in Warp it works fine and I don't need to remove it.

@fredrikaverpil
Copy link
Contributor

fredrikaverpil commented Oct 20, 2024

@PiotrRaszkowski nice, I'm on Wezterm and I think it's ok performance wise at least for my use cases when using Neovim. Also very nice to configure it using Lua.

I've heard Kitty is the most performant terminal out there, unless you have access to ghostty (which is right now invite-only but scheduled for release end of 2024).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants