From af4562d2e3c9ee131c87268b29cce960eedc9c89 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 15 Aug 2023 00:06:24 +0100 Subject: [PATCH] tests.sh: fix coverage --- .luacov | 1 + tests.sh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.luacov b/.luacov index 9de8ae6..114d4cb 100644 --- a/.luacov +++ b/.luacov @@ -3,6 +3,7 @@ reporter = "html" return { modules = { ["worldeditadditions_core.**"] = "worldeditadditions_core", + ["worldeditadditions_core.utils.parse.**"] = "worldeditadditions_core.parse" }, include = { "worldeditadditions_core$", diff --git a/tests.sh b/tests.sh index f48a07c..899ab70 100755 --- a/tests.sh +++ b/tests.sh @@ -94,7 +94,11 @@ run_test() { if [[ "${OSTYPE}" == *"msys"* ]]; then "${busted_path}" --no-auto-insulate --pattern ".test.lua" .tests; else + if [[ -r "luacov.stats.out" ]]; then rm "luacov.stats.out"; fi + + set +e; "${busted_path}" --coverage --no-auto-insulate --pattern ".test.lua" .tests; + set -e; # Delete any pre-existing coverage info from any prev runs if [[ -d "luacov-html" ]]; then rm -r "luacov-html"; fi @@ -106,7 +110,7 @@ run_test() { # Remove, but only if empty if [[ -s "luacov.report.out" ]]; then : - else rm "luacov.report.out"; fi + elif [[ -e "luacov.report.out" ]]; then rm "luacov.report.out"; fi echo -e "Output written to $(display_url "file://$PWD/luacov-html/index.html" "./luacov-html/index.html")"; fi