Disable nvim's output in tests
backdround opened this issue · comments
I'm testing a plugin which performs searchs. During the tests a headless neovim outputs this to the terminal
Is there a way to mute the stderr output?
I've read this like 5 times and i have no idea what you are tying to do, can you elaborate?
Or can you provide a codesnippet? anything?
Sorry for the unclear description, @Conni2461 .
Neovim by default prints search-commands (/
) into stderr output when used in the headless mode:
nvim --headless -u NONE -c ":normal! /hello<cr>" -c 'qa!'
# will prints:
/hello<cr>
The problem is when I test a plugin that performs search-commands(/
), such output (from search commands) ends up in the tests output because test_harness porxies stderr.
I tried to perform commands with :silent!
, but it doesn't seem to work if a plugin calls vim.cmd
by itself.
Also, I noticed that tests don't provide such output if only one file is being tested. I didn't manage to figure out why
@Conni2461
minimal example of this
test_spec.lua:
local some_plugin_function = function()
for _=0, 10 do
-- The culprit!
vim.cmd("normal! n")
end
end
describe("issue-example", function()
it("test", function()
vim.api.nvim_buf_set_lines(0, 0, 0, true, {
"some text",
"in buffer"
})
vim.fn.setreg("/", "buffer")
some_plugin_function()
end)
end)
stub_spec.lua:
-- can be empty