From c53d62ffec8a0b784a5460dd9aab6ade99dc78b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Fl=C3=BCgge?= Date: Sun, 31 Dec 2023 18:13:45 +0100 Subject: [PATCH] fix: schedule vim commands in state_spec test Fix test on CLI AND Neotest by executing the vim commands asynchronously. This test was not marked as failed when it ran from the command line, although the error was visible in the output. In Neotest it was actually marked as failed. --- tests/plenary/state/state_spec.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/plenary/state/state_spec.lua b/tests/plenary/state/state_spec.lua index dc16b859d..9be15aa5a 100644 --- a/tests/plenary/state/state_spec.lua +++ b/tests/plenary/state/state_spec.lua @@ -79,10 +79,9 @@ describe('State', function() it('should be able to self-heal from an invalid state file', function() state:save_sync() - -- Mangle the cache - vim.cmd.edit(cache_path) + vim.cmd(('edit %s'):format(cache_path)) vim.api.nvim_buf_set_lines(0, 0, -1, false, { '[ invalid json!' }) - vim.cmd.write() + vim.cmd('write') -- Ensure we reload the state from its cache file (this should also "heal" the cache) state._ctx.loaded = false