test_frontend.sh 739 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. # Typecheck and lint run in parallel (both are 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. wait $typecheck_pid
  11. typecheck_rc=$?
  12. wait $lint_pid
  13. lint_rc=$?
  14. cat /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$
  15. rm -f /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$
  16. npm run test:run
  17. test_rc=$?
  18. cd ..
  19. if [ $typecheck_rc -ne 0 ] || [ $lint_rc -ne 0 ] || [ $test_rc -ne 0 ]; then
  20. echo "FAILED: typecheck=$typecheck_rc lint=$lint_rc tests=$test_rc"
  21. exit 1
  22. fi