test_frontend.sh 908 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Typecheck, lint and knip run in parallel (all read-only and independent),
  3. # then the tests. Exits non-zero if any step fails, so a type or lint error
  4. # can't scroll past unnoticed behind a green test run.
  5. cd frontend || exit 1
  6. npm run typecheck > /tmp/bambuddy-typecheck.$$ 2>&1 &
  7. typecheck_pid=$!
  8. npm run lint > /tmp/bambuddy-lint.$$ 2>&1 &
  9. lint_pid=$!
  10. npm run check:knip > /tmp/bambuddy-knip.$$ 2>&1 &
  11. knip_pid=$!
  12. wait $typecheck_pid
  13. typecheck_rc=$?
  14. wait $lint_pid
  15. lint_rc=$?
  16. wait $knip_pid
  17. knip_rc=$?
  18. cat /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$ /tmp/bambuddy-knip.$$
  19. rm -f /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$ /tmp/bambuddy-knip.$$
  20. npm run test:run
  21. test_rc=$?
  22. cd ..
  23. if [ $typecheck_rc -ne 0 ] || [ $lint_rc -ne 0 ] || [ $knip_rc -ne 0 ] || [ $test_rc -ne 0 ]; then
  24. echo "FAILED: typecheck=$typecheck_rc lint=$lint_rc knip=$knip_rc tests=$test_rc"
  25. exit 1
  26. fi