Skip to content

Commit 7e8e5fd

Browse files
authored
fix: schedule vim commands in state_spec test (#642)
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. Co-authored-by: Sebastian Flügge <seflue@users.noreply.github.com>
1 parent 768b278 commit 7e8e5fd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/plenary/state/state_spec.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ describe('State', function()
7979
it('should be able to self-heal from an invalid state file', function()
8080
state:save_sync()
8181

82-
-- Mangle the cache
83-
vim.cmd.edit(cache_path)
82+
vim.cmd(('edit %s'):format(cache_path))
8483
vim.api.nvim_buf_set_lines(0, 0, -1, false, { '[ invalid json!' })
85-
vim.cmd.write()
84+
vim.cmd('write')
8685

8786
-- Ensure we reload the state from its cache file (this should also "heal" the cache)
8887
state._ctx.loaded = false

0 commit comments

Comments
 (0)