Skip to content

Commit

Permalink
test: detect stack traceback in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MunifTanjim committed May 4, 2024
1 parent 42e4756 commit 274fa89
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,23 @@ setup_environment

luacov_start

declare test_logs=""

if [[ -d "./tests/${test_scope}/" ]]; then
nvim --headless --noplugin -u tests/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/${test_scope}/', { minimal_init = 'tests/init.lua', sequential = true })"
test_logs=$(nvim --headless --noplugin -u tests/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/${test_scope}/', { minimal_init = 'tests/init.lua', sequential = true })")
elif [[ -f "./tests/${test_scope}_spec.lua" ]]; then
nvim --headless --noplugin -u tests/init.lua -c "lua require('plenary.busted').run('./tests/${test_scope}_spec.lua')"
test_logs=$(nvim --headless --noplugin -u tests/init.lua -c "lua require('plenary.busted').run('./tests/${test_scope}_spec.lua')")
fi

echo "${test_logs}"

luacov_end

if echo "${test_logs}" | grep --quiet "stack traceback"; then
{
echo ""
echo "FOUND STACK TRACEBACK IN TEST LOGS"
echo ""
} >&2
exit 1
fi

0 comments on commit 274fa89

Please sign in to comment.