From 5aefbdacaa0008614260820c65a00a5b10355d21 Mon Sep 17 00:00:00 2001 From: Iisyourdad Date: Thu, 11 Jun 2026 09:13:39 -0500 Subject: [PATCH] Fix unit test discovery --- tests/checks/test_unit_workflows.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) mode change 100644 => 100755 tests/checks/test_unit_workflows.sh diff --git a/tests/checks/test_unit_workflows.sh b/tests/checks/test_unit_workflows.sh old mode 100644 new mode 100755 index 1020734..4b57ae5 --- a/tests/checks/test_unit_workflows.sh +++ b/tests/checks/test_unit_workflows.sh @@ -7,4 +7,23 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$ROOT_DIR" -node --test tests/unit/ +if [[ ! -d "tests/unit" ]]; then + echo "No tests/unit directory found, skipping unit tests." + exit 0 +fi + +mapfile -t unit_tests < <(find tests/unit -type f \( \ + -name "*.test.js" -o \ + -name "*.spec.js" -o \ + -name "*.test.mjs" -o \ + -name "*.spec.mjs" -o \ + -name "*.test.cjs" -o \ + -name "*.spec.cjs" \ +\) | sort) + +if [[ "${#unit_tests[@]}" -eq 0 ]]; then + echo "No unit test files found under tests/unit, skipping unit tests." + exit 0 +fi + +node --test "${unit_tests[@]}" \ No newline at end of file