chore: plenary tests POC: harden directories
This commit is contained in:
parent
2dcf249d49
commit
f9dc294829
@ -4,16 +4,17 @@ set -e
|
||||
|
||||
# TODO add ability for user to specify a test file or directory
|
||||
|
||||
REPO_DIR="$(git rev-parse --show-toplevel)"
|
||||
export REPO_DIR
|
||||
# TODO clone plenary
|
||||
|
||||
PLENARY_DIR="${REPO_DIR}/plenary.nvim"
|
||||
export PLENARY_DIR
|
||||
DIR_REPO="$(git rev-parse --show-toplevel)"
|
||||
export DIR_REPO
|
||||
|
||||
DIR_PLENARY="${DIR_REPO}/plenary.nvim"
|
||||
export DIR_PLENARY
|
||||
|
||||
nvim --headless \
|
||||
--clean \
|
||||
--noplugin \
|
||||
-u "tests/minimal_init.lua" \
|
||||
-c "lua require('plenary.test_harness').test_directory('tests/', { minimal_init = './tests/minimal_init.lua' })" \
|
||||
-u "${DIR_REPO}/tests/minimal_init.lua" \
|
||||
-l "${DIR_REPO}/tests/test_init.lua" \
|
||||
-c "qa!"
|
||||
|
||||
|
||||
@ -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
7
tests/test_init.lua
Normal 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 })
|
||||
|
||||
Loading…
Reference in New Issue
Block a user