Skip to content

Commit

Permalink
fix: schedule vim commands in state_spec test (#642)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
seflue and seflue authored Jan 9, 2024
1 parent 768b278 commit 7e8e5fd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/plenary/state/state_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e8e5fd

Please sign in to comment.