Files
overleaf-cep/services/web/bin/test_unit_run_dir
Andrew Rumble f1e788d9b3 Merge pull request #29967 from overleaf/ar/web-remove-mocha-unit-tests
[web] remove mocha unit tests

GitOrigin-RevId: eda753af3470dbd1f385cb0bc3f06d78ade8a764
2025-12-03 09:05:37 +00:00

37 lines
836 B
Bash
Executable File

#!/bin/bash
declare -a vitest_args=("$@")
if [[ -n "$MOCHA_GREP" ]]; then
vitest_args+=("--testNamePattern" "$MOCHA_GREP")
fi
if [[ -n "$VITEST_NO_CACHE" ]]; then
echo "Disabling cache for vitest."
vitest_args+=("--no-cache")
fi
echo "Running unit tests in directory: $*"
npm run test:unit:parallel -- "${vitest_args[@]}"
vitest_parallel_status=$?
npm run test:unit:sequential -- "${vitest_args[@]}"
vitest_sequential_status=$?
if [ "$vitest_sequential_status" -eq 0 ] && [ "$vitest_parallel_status" -eq 0 ]; then
exit 0
fi
# Report status briefly at the end for failures
if [ "$vitest_parallel_status" -ne 0 ]; then
echo "Parallel tests failed with status: $vitest_parallel_status"
fi
if [ "$vitest_sequential_status" -ne 0 ]; then
echo "Sequential tests failed with status: $vitest_sequential_status"
fi
exit 1