--- Headless entry point for the e2e suite. Bootstraps the runtimepath and --- package.path, loads the plugin, runs every `*_spec.lua` in this directory, --- and exits non-zero if any test failed (so CI fails honestly). --- --- nvim --headless -u NONE -c "luafile tests/e2e/run.lua" local here = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p") local root = vim.fn.fnamemodify(here, ":h:h:h") -- .../heph.nvim (absolute) local e2e = root .. "/tests/e2e" vim.opt.runtimepath:append(root) package.path = root .. "/tests/?.lua;" .. root .. "/tests/?/init.lua;" .. package.path vim.cmd("runtime plugin/heph.lua") local runner = require("e2e.runner") runner.install_globals() local files = vim.fn.glob(e2e .. "/*_spec.lua", false, true) table.sort(files) -- Guard against a false green: zero specs found (e.g. a path/glob mistake in a -- container) must fail, not pass silently. if #files == 0 then io.stderr:write("heph e2e: no *_spec.lua found under " .. e2e .. "\n") vim.cmd("cquit 1") return end local failed = runner.run_files(files) vim.cmd(failed > 0 and "cquit 1" or "quit")