/liv:liv-testerfrom liv
How to write and run cross-editor tests for a liv plugin with liv.tester — L1 (spec/, editor-free) vs L3 (test/, real Vim +lua AND Neovim, headless), describe/it/assert, selectors (name:/tag:, it.only/it.skip), reporters (spec/tap/jsonl/junit), and bin/liv-tester / :LivTest flags (--select, --failed, --seed, --watch, --jobs, --editor, --fail-fast/--max-failures). Use when writing test specs, running the suite, debugging failures, or filtering tests.
Ships in liv. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
liv.tester is a dependency-free, cross-editor test framework + runner. Because it
is pure Lua, one suite runs both in-process (L1) and inside the editors
(L3). It is a dev tool: never vendored. Canonical entry liv.tester.cli.main;
shims are bin/liv-tester and :LivTest.
spec/, no editor, plain lua/busted. For pure logic
(liv.lua.*, marshaling classify, async runner, bundler analyze/rewrite/lockfile,
path, …). Fast; runs anywhere.test/, real Vim +lua AND Neovim, headless. For
liv.core marshaling/bridge and each _vim/_nvim backend. Both backends bind
native refs, so backend contract logic is asserted here on both editors — there
is no L2 mock-core layer. Each test/ file runs in its own editor process
per editor, with a per-file timeout, so one crashing/hanging spec costs only that
cell.By convention many test/ describe names carry a (L3) suffix; the framework now
labels the layer structurally, so it is redundant but left in place.
local buffer = require("liv.std.buffer")
describe("liv.std.buffer (L3)", function()
before_all(function() --[[ setup ]] end)
after_all(function() --[[ teardown ]] end)
it("set_lines replaces a 1-based inclusive range", function()
buffer.set_lines(0, 1, 1, { "hello" })
assert.same({ "hello" }, buffer.lines(0, 1, 1))
end)
it.skip("not ready yet", function() end)
end)
describe / it / before_all / after_all / finally; pending() and
it.skip mark skipped; it.only / describe.only focus.assert: same (deep equal — names the first diverging key
path on failure), equal, truthy, match, length_of, includes, … and an
async helper that drives a liv.lua.async function to completion synchronously.liv.std modules receive liv.core (substitute a mock
in L1); the async runner receives schedule/leaf primitives so tests drive
coroutines synchronously. Avoid global state (no global vim mutation, no hidden
singletons).bin/liv-tester # spec/ as L1 + test/ as L3 (both editors)
bin/liv-tester --editor=nvim # L3 on Neovim only
bin/liv-tester init # scaffold .liv-tester.lua + an example spec
Flags (values use =, e.g. --select=tag:smoke):
--select=<selector> — filter by a name:/tag: mini-language (! negation,
comma = AND, repeat the flag = OR). Repeatable; ANDs with --failed.--reporter=<name> — spec (human; default on a TTY), tap (default
non-TTY), jsonl, or junit.--verbose / --quiet — more / less spec-reporter detail.--jobs=<N> — run up to N L3 child editors in parallel (default 1).--fail-fast / --max-failures=<N> — stop launching new L3 cells after the
first / Nth failure.--editor=<which> — nvim, vim, or both (default).--seed=<N> — randomize order reproducibly (echoes the seed; opt-in, default is
declaration order).--failed — rerun ONLY the previous run's failures (exact full-title match —
test names contain pattern-magic chars, so it is NOT the --select pattern path).--list — print the filtered candidate names without running.--watch — re-run on any change under spec/ test/ lua/ (mtime poll).Exit codes: 0 all passed, 1 test failures, 2 usage error, 4 no tests
found.
Config: .liv-tester.lua at the project root; precedence is CLI > config >
default (an absent flag never clobbers a config value).
One reporter renders every layer (L1, then each L3 editor) as one continuous,
sectioned stream: a per-layer header (# L1 (no editor) / # L3 (nvim) / …),
continuous numbering across layers, then the plan and a single summary, with
the L1/L3 roll-up + TOTAL below. Each L3 test is visible individually (not just
an aggregate count); a crash/timeout/skip-budget cell is synthesized into a visible
record so the plan count always matches the summary. Reporters render the layer
their own way (spec a bold header, tap a # <layer> comment, jsonl a layer
field, junit a <testsuite> per layer inside a <testsuites> root).
vim-liv repo spec: .claude/specs/0010-testing.md. Related skills:
liv-plugin-authoring, liv-library-api.
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/liv-bundlerHow to vendor liv (and other pure-Lua deps) into a consumer plugin with liv.bundler, so end users install only the plugin. Use when bundling/vendoring liv into a plugin, running :LivAdd/:LivUpdate/:LivCheck/:LivRemove or bin/liv-bundler, choosing a source resolver (rtp/git/path/luarock), understanding the lockfile/tree-shaking/migration-notices, or declaring dynamic deps and .vim companions in a manifest./liv-library-apiReference for the liv runtime API a plugin author consumes — liv.core (call/eval/cmd/marshaled/is_nvim + marshaling), the liv.std.* editor-dependent modules (buffer, window, process, task, fs, fetch, ui, option, variable, autocmd, mapping, keys, highlight, sign, text, log, has, …) and the liv.lua.* pure modules (compat, async, path, uri, argument, base64, hash, color, png/zlib/msgpack, …). Use when calling or looking up a liv API, choosing the right module, or checking capability/degradation./liv-plugin-authoringConventions for writing a liv plugin — one Lua source that runs on both Vim 9 (+lua) and Neovim. Use when creating or editing code in a liv-based plugin, deciding where a module belongs (liv.core/liv.std/liv.lua), or reviewing liv code for the framework's hard rules (own-the-contract naming, 1-based ranges, Lua 5.1 dialect, string-literal require, barrel/leaf splits).Other plugins' skills for the same job
npx claudepluginhub lambdalisue/vim-liv --plugin liv