Closed benlubas closed 1 year ago
Played around with this some more. It's related to the quickfix list. Here are some things that I discovered:
1000000.times { puts "hello" }
stalls it long enough for me to attach with a keybind. I believe this is a neovim internals issue but I've made a small change in the output consumer and it seems to have fixed it for me, but it also doesn't reproduce reliably. Can you verify?
I tested with the new changes and the ruby issue still happens 10/10 times.
The method of reproducing with jest now doesn't reproduce on the first test run. But subsequent runs of the test do cause the bug seemingly 100% of the time.
Just wanted to drop in to say I'm experiencing this same issue with a python/django project, disabling quickfix worked for me as well
This is also happening to me on jest. If you have the summary open and your cursor there, the qf will take over the summary too. Very strange. I disabled qf for now
As this is a race condition within Neovim core there's not too much that neotest can do. I've disabled quickfix opening by default since it doesn't make much sense having both output and quickfix open at the same time anyway so at least users won't see it by default
NeoVim Version
output of `nvim --version`
NVIM v0.8.3 Build type: Release LuaJIT 2.1.0-beta3 Compiled by linuxbrew@1eb16d0118e5 Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: " /home/linuxbrew/.linuxbrew/Cellar/neovim/0.8.3/share/nvim" Run :checkhealth for more infoDescribe the bug Sometimes when running a test the test file is closed and the cmdheight seems to get set to a large number. I've had this problem across MacOS and Linux, and it's happened with ruby/rspec and javascript/jest tests.
Here is a recording of what it looks like:
https://user-images.githubusercontent.com/56943754/224509195-98a9b46b-8b76-4573-ac23-e32f027b9514.mp4
I've seen the same thing happen with jest tests too. I haven't figured out a reliable way to quickly reproduce that one yet. In the jest case, there is nothing like binding.pry, and no need to attach to the running test. Sometimes the test will just fail, and the bug happens.
To Reproduce
minimal.lua
```lua -- ignore default config and plugins vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim")) vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site")) vim.opt.termguicolors = true -- append test directory local test_dir = "/tmp/nvim-config" vim.opt.runtimepath:append(vim.fn.expand(test_dir)) vim.opt.packpath:append(vim.fn.expand(test_dir)) -- install packer local install_path = test_dir .. "/pack/packer/start/packer.nvim" local install_plugins = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) vim.cmd("packadd packer.nvim") install_plugins = true end local packer = require("packer") packer.init({ package_root = test_dir .. "/pack", compile_path = test_dir .. "/plugin/packer_compiled.lua", }) packer.startup(function(use) use("wbthomason/packer.nvim") use({ "nvim-neotest/neotest", requires = { "vim-test/vim-test", "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", "olimorris/neotest-rspec", }, config = function() require("neotest").setup({ adapters = {require("neotest-rspec")}, }) end, }) if install_plugins then packer.sync() end end) vim.cmd([[ command! NeotestSummary lua require("neotest").summary.toggle() command! NeotestFile lua require("neotest").run.run(vim.fn.expand("%")) command! Neotest lua require("neotest").run.run(vim.fn.getcwd()) command! NeotestNearest lua require("neotest").run.run() command! NeotestDebug lua require("neotest").run.run({ strategy = "dap" }) command! NeotestAttach lua require("neotest").run.attach() command! NeotestOutput lua require("neotest").output.open() ]]) ```Steps to reproduce the behavior:
nix-env -iA nixpkgs.ruby
orbrew install ruby
mkdir neotest-bug && cd neotest-bug
echo "gem 'rspec'" >> Gemfile && echo "gem 'pry'" >> Gemfile
mkdir spec && touch spec/sample_spec.rb
sample_spec.rb
:describe 'a test' do it 'does a weird thing' do expect(true).to be true # correct test binding.pry expect(true).to be false # failing test end end