#!/usr/bin/env bash # run-pw.sh — run Playwright tests via nohup; poll output file # Usage: # ./run-pw.sh # Example: # ./run-pw.sh /tmp/pw-t83.log packages/chess/e2e/request-choice.spec.ts --reporter=list # # Then poll: while [[ ! -f /tmp/pw-t83.log.done ]]; do sleep 5; done; cat /tmp/pw-t83.log set -uo pipefail OUTFILE="${1:?need output file path}" shift # Spawn detached; touch DONE marker when complete (success or failure) # NOTE: do NOT set CI=true — that flips Playwright's reuseExistingServer to # false and makes it try to spawn its own webServer on :5173, which collides # with the docker compose dev stack (paratype-web-dev). Leaving CI unset # means reuseExistingServer=true → Playwright connects to the running dev # server in docker. nohup bash -c " cd /home/joey/Projects/rules export GIT_TERMINAL_PROMPT=0 GIT_PAGER=cat PAGER=cat bunx playwright test $* > '$OUTFILE' 2>&1 echo \"EXIT_CODE=\$?\" >> '$OUTFILE' touch '$OUTFILE.done' " >/dev/null 2>&1 & disown PID=$! echo "Spawned pw run (pid=$PID); output -> $OUTFILE; done-marker -> $OUTFILE.done"