chore(tests): move tests out of lua directory (#621)

This commit is contained in:
kylo252 2022-03-25 14:35:59 +01:00 committed by GitHub
parent 181b14348f
commit 5a91d816a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 2 deletions

View File

@ -12,7 +12,7 @@ test:
@mkdir -p tmp_home
@export XDG_DATA_HOME='./tmp_home' && \
export XDG_CONFIG_HOME='./tmp_home' && \
nvim --headless -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })" -c "qa!"
bash ./scripts/test_runner.sh
@rm -rf tmp_home
# Install luacov & luacov-console from luarocks
@ -22,7 +22,7 @@ testcov:
@export XDG_DATA_HOME=$(realpath './tmp_home/data') && \
export XDG_CONFIG_HOME=$(realpath './tmp_home/config') && \
export TEST_COV=true && \
nvim --headless -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })" -c "qa!"
bash ./scripts/test_runner.sh
@luacov-console lua/
@luacov-console -s
ifeq ($(NOCLEAN), )

14
scripts/test_runner.sh Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
REPO_DIR=$(git rev-parse --show-toplevel)
nvim_t() {
nvim -u "$REPO_DIR/tests/minimal_init.lua" -c "set runtimepath+=$REPO_DIR" "$@"
}
if [ -n "$1" ]; then
nvim_t --headless -c "lua require('plenary.busted').run('$1')"
else
nvim_t --headless -c "lua require'plenary.test_harness'.test_directory( 'tests/', { minimal_init = './tests/minimal_init.lua' })" -c "qa!"
fi