Mneme - Snapshot testing tool for the busy programmer

Rigged up an incredibly quick spec cycle, alongside neovim.io, nushell.sh , and zellij.dev -

map <Leader>sa :wall \| !zellij run -f -- nu -e "nd mix test; zellij action toggle-floating-panes; zellij action write 10; exit";<CR>

(or is this called a “guess-and-check” cycle?)

This command could be used as-is in other forks of vim.
To use alongside bash, replace each ; using &&.

I use a test module as @zachallaun recommends:

defmodule SampleTest do
  use ExUnit.Case, async: true
  use Mneme, action: :accept, default_pattern: :last
  test "abc..." do
    auto_assert [:abc, 123]
  end
end

In this loop I press <space>sa (check your vim’s leader key) -
this opens a floating pane in Zellij which is hidden once the specs end successfully.
The zellij action write 10 causes neovim to reload the file once the spec pane is hidden.

3 Likes