Problem: The plenary-to-busted migration surfaced three test isolation issues whose root causes and fixes were not documented. Solution: Add spec/TESTING.md recording the issues, their root causes, and the applied fixes for future reference. Update CLAUDE.md test section with correct framework, run command, and test count.
2 KiB
Test Framework Migration Log
Issues encountered during the plenary-to-busted migration (6be0148) and
how they were resolved.
Final status
114 successes / 0 failures / 0 errors.
Issue 1: altbuf_spec.lua:18 — BufEnter wait mismatch (resolved)
The test sets previous buffer as alternate when editing url file originally
waited for two BufEnter events via wait_for_autocmd('BufEnter') x2.
The oil:// → real file resolution only produces one async BufEnter:
vim.cmd.edit('oil://...')fires BufEnter synchronously (before any wait_for_autocmd is registered)normalize_urlresolves asynchronously viauv.fs_realpath+uv.fs_statrename_bufferdiscovers dest is a real file on disk, schedulesnvim_win_set_buf()viavim.schedule()nvim_win_set_buf()fires one async BufEnter on the real file buffer
The second wait_for_autocmd('BufEnter') was never correct — it passed under
plenary due to coroutine event loop yielding, not because a second BufEnter
actually fired.
Fix: single wait_for_autocmd('BufEnter').
Issue 2: regression_spec.lua:20 — stale preview window state (resolved)
reset_editor() closed all windows except the first, but the surviving window
could be a preview window with stale oil_preview, oil_source_win,
previewwindow, etc. from a prior test. Subsequent tests that triggered
close_preview_window_if_not_in_oil() would close the wrong window.
Fix: vim.cmd.new() + vim.cmd.only() creates a fresh window and closes
all others (including the stale one). No variable cleanup needed — the new
window has no oil state.
Issue 3: preview_spec.lua:30 — M.await timed out (resolved)
Originally thought to be a pre-existing issue unrelated to the migration. Root
cause was identical to issue 2: stale preview window state from a prior test
caused close_preview_window_if_not_in_oil() to close the wrong window during
oil.open(), preventing the callback from completing.
Fixed by the same vim.cmd.new() + vim.cmd.only() approach in
reset_editor().