#!/bin/bash set -euo pipefail INCLUDE_INTEGRATION=false if [[ "${1:-}" == "--integration" ]]; then INCLUDE_INTEGRATION=true fi JOBS="${AURORA_TEST_JOBS:-4}" echo "๐Ÿ” Finding test files..." if [ "$INCLUDE_INTEGRATION" = true ]; then FIND_ARGS=( -name "*.test.ts" ) else FIND_ARGS=( -name "*.test.ts" -not -name "*.integration.test.ts" ) fi TEST_FILES=() while IFS= read -r file; do TEST_FILES+=("$file") done < <(find . "${FIND_ARGS[@]}" -not -path "*/node_modules/*" | sort) if [ "${#TEST_FILES[@]}" -eq 0 ]; then echo "โš ๏ธ No test files found!" exit 0 fi echo "๐Ÿงช Running ${#TEST_FILES[@]} test files with isolated Bun processes..." echo " Workers: $JOBS" if [ "$INCLUDE_INTEGRATION" = true ]; then echo " (including integration tests)" fi if printf '%s\n' "${TEST_FILES[@]}" | xargs -n1 -P "$JOBS" bash -lc 'echo "---------------------------------------------------"; echo "running: $1"; bun test "$1"' _; then echo "---------------------------------------------------" echo "โœ… All tests passed!" exit 0 fi echo "---------------------------------------------------" echo "โŒ Some tests failed." exit 1