-
-
Notifications
You must be signed in to change notification settings - Fork 127
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] Neovim freezes forever when saving test file #468
Comments
I just tried for a rust project i have and i'm getting the exact same problem |
When I conditionally load config = function()
local neotest = require("neotest")
local neotestJest = require("neotest-jest")
local jestUtil = require("neotest-jest.jest-util")
local setup_complete = false
vim.diagnostic.config({ virtual_text = true })
local function possibly_init()
if setup_complete then
return
end
local adapters = {}
-- Load neotest-jest conditionally
if vim.bo.filetype == "typescript" or vim.bo.filetype == "typescriptreact" then
table.insert(
adapters,
neotestJest({
jestCommand = jestUtil.getJestCommand(vim.fn.expand("%:p:h")),
cwd = function()
return vim.fs.dirname(vim.fn.expand("%"))
end,
})
)
end
table.insert(adapters, require("neotest-gradle"))
table.insert(adapters, require("neotest-rust"))
neotest.setup({
log_level = vim.log.levels.DEBUG,
floating = {
border = "rounded",
max_height = 100,
max_width = 100,
options = {},
},
adapters = adapters,
})
setup_complete = true
end
local function test_nearest()
possibly_init()
neotest.run.run({ suite = false })
neotest.summary.open()
end
local function watch_tests()
possibly_init()
neotest.watch.watch({
suite = false,
})
neotest.summary.open()
end
vim.keymap.set("n", "<leader>tn", test_nearest, { desc = "[T]est [N]earest" })
vim.keymap.set("n", "<leader>tw", watch_tests, { desc = "[T]est [W]atch" })
end Maybe something similar is happening with the dotnet adapter? |
I am encountering the same issue with |
I have the same issue but it happens every time I load neovim. Using |
I have the same issue after saving a test file. As according to the logs' last line:
This indicates that the problem lies in the And after examining 2 call sites of the former function I found that the call from As a workaround, I tried hard-coding |
Small update: it wasn't necessary to completely disable subprocesses on a per-module basis. I managed to resolve the issue by reading files during test discovery in a blocking manner: https://github.com/ruslanSorokin/neotest/tree/hotfix/issue-468/configure-use-of-subprocesses-in-parse_positions This is certainly not a solution, as UI blocks. However, it at least allows us to identify whether we are encountering the same problem. Snippet to check it out: {
"ruslanSorokin/neotest",
branch = "hotfix/issue-468/configure-use-of-subprocesses-in-parse_positions",
opts = { discovery = { use_subprocess = false } },
} |
I've tested using your branch @ruslanSorokin with a C# and Rust project and it doesn't seem to made a difference wether {
"ruslanSorokin/neotest",
branch = "hotfix/issue-468/configure-use-of-subprocesses-in-parse_positions",
opts = { discovery = { use_subprocess = false } },
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"Issafalcon/neotest-dotnet",
"rouge8/neotest-rust",
},
} A while i ago i tried to clone the repo and debug it. Unfortunately i didn't make a new comment back then about what i learned, but from what i remember i think it had something to do with the state being I might just go through that again, i'm just not very versed in lua debugging yet so this repo is a little tricky for me xD |
same here with marilari88/neotest-vitest, my lazyvim configs: return {
{
"nvim-neotest/neotest",
dependencies = {
"marilari88/neotest-vitest",
},
opts = {
log_level = 0,
adapters = {
["neotest-vitest"] = {
filter_dir = function(name, rel_path, root)
return name ~= "node_modules"
end
}
}
}
}
} the last lines written to DEBUG | 2025-01-05T00:18:52Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event test_focused
INFO | 2025-01-05T00:18:53Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:48 | Emitting test_focused event
DEBUG | 2025-01-05T00:18:53Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event test_focused
INFO | 2025-01-05T00:18:54Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:48 | Emitting test_focused event
DEBUG | 2025-01-05T00:18:54Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event test_focused
INFO | 2025-01-05T00:19:00Z+0100 | ...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:299 | Parsing ~/Workspace/faker-cli/test/cli.test.ts
DEBUG | 2025-01-05T00:19:00Z+0100 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:140 | Waiting for result 2 $ nvim --version 27ms 0
NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1734355927
$ sw_vers 42ms 0
ProductName: macOS
ProductVersion: 15.2
BuildVersion: 24C101
○ neotest
version 5.8.0
commit d66cf4e |
I'm facing a similar issue when running python tests. Neovim freezes when running any neotest commands. I see the following inside neotest.log:
|
TLDR: I spent a few days looking for this problem, even looking through the neo-nio source code, and I found that it was a problem with flatten.nvim, because neotest subprocess was started in the same directory, so flatten.nvim caused the child process to exit immediately |
@skolj |
@AbaoFromCUG Thanks for the analysis! I'm not using flatten.nvim though (not directly at least). Not sure if neotest or its dependencies use it. |
NeoVim Version
Output of
nvim --version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
System info
Windows 11
Neovim is running on
wezterm 20240203-110809-5046fc22
Describe the bug
Neovim freezes when saving a file which contains tests that neotest can discover.
To Reproduce
Please provide a minimal
init.lua
to reproduce which can be run as the following:You can edit the following example file to include your adapters and other required setup.
Steps to reproduce the behavior:
Please provide example test files to reproduce.
Expected behavior
I expect neovim to not freeze forever when saving a file with tests.
Perhaps a second of freezing is acceptable, but making the editor unusable is unhelpful.
Logs
No logs are produced
Additional context

It happend very consistently, but in some odd cases it seemed to be fine. If i created a file and wrote a test, then saved and ran the test, it worked. However even then if i navigated to existing tests, made some edits, and saved, it would freeze again.
Here is what the Windows Task Manager looks like. This is the only instance on nvim.exe in the task manager.
I'm not sure what to make of it except some process has been marked as suspended
The text was updated successfully, but these errors were encountered: