chore: plenary tests POC: harden directories

This commit is contained in:
Alexander Courtis
2025-02-03 14:45:26 +11:00
parent 2dcf249d49
commit f9dc294829
3 changed files with 23 additions and 15 deletions

View File

@@ -1,8 +1,8 @@
-- this file is necessary for the minimal_init option which directs the spawned nvim test instances be run with --noplugin
-- ensure that this nvim-tree is not overridden by installed versions in .local/share/nvim/site etc.
vim.o.runtimepath = vim.env.REPO_DIR .. "," .. vim.o.runtimepath
-- plenary will append ,.,$HOME/src/nvim-tree/master/plenary.nvim in the spawned test instances, however we want this here to prevent overrides
vim.o.runtimepath = vim.env.PLENARY_DIR .. "," .. vim.o.runtimepath
-- Prepend these as plenary appends a "." and plenary directory
-- The spawned processes don't specify --clean so contain the full ~/.local runtime path
vim.o.runtimepath = string.format(
"%s,%s,%s",
vim.env.DIR_REPO,
vim.env.DIR_PLENARY,
vim.o.runtimepath
)

7
tests/test_init.lua Normal file
View File

@@ -0,0 +1,7 @@
local test_harness = require('plenary.test_harness')
local DIR_TEST = vim.env.DIR_REPO .. '/tests'
local FILE_MINIMAL_INIT = DIR_TEST .. '/minimal_init.lua'
test_harness.test_directory(DIR_TEST, { minimal_init = FILE_MINIMAL_INIT })