From 8e49e68393aee7ea29d6750530af301e9abc0b1f Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 12 May 2026 01:05:54 +0100 Subject: [PATCH] Pre-check integration node_modules before root-playwright wrapper assertion --- scripts/tests/test-hot-dev-bg.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh index d25de39044..794da0e049 100755 --- a/scripts/tests/test-hot-dev-bg.sh +++ b/scripts/tests/test-hot-dev-bg.sh @@ -834,20 +834,28 @@ test_root_playwright_wrapper_prefers_managed_browser_runtime() { } EOF - # The root playwright.config.ts imports @playwright/test (devDependency + # Skip in environments without the tests/integration npm install, since + # the root playwright.config.ts imports @playwright/test (devDependency # of tests/integration/, not the workspace root) and chain-imports - # runtime-defaults.ts. Both create environment-sensitivity: the package - # may not be installed (fresh clones, CI smoke jobs that haven't run - # the integration-tests setup) and tsx's `--eval` mode doesn't always - # propagate the TS loader to transitive .ts requires under some Node - # versions. Treat any of those as a skip rather than letting an env - # quirk fail the suite. - if ! output="$( + # runtime-defaults.ts. Without those node_modules, npx tsx --eval blows + # up before bash sees an exit code we can guard on. The CI smoke job + # and fresh clones both hit this; the test only meaningfully checks + # local-dev behavior anyway. + if [[ ! -d "${ROOT_DIR}/tests/integration/node_modules/@playwright/test" ]]; then + echo "[SKIP] root-playwright wrapper check (tests/integration/node_modules/@playwright/test not installed)" + return 0 + fi + + set +e + output="$( cd "${ROOT_DIR}" && \ PULSE_E2E_RUNTIME_STATE_PATH="${runtime_state}" \ npx --yes tsx --eval "import config from './playwright.config.ts'; console.log(config.use?.baseURL || '');" 2>&1 - )"; then - echo "[SKIP] root-playwright wrapper check (tsx/playwright eval not available: ${output:0:80}...)" + )" + local rc=$? + set -e + if (( rc != 0 )); then + echo "[SKIP] root-playwright wrapper check (tsx eval failed rc=${rc}: ${output:0:80})" return 0 fi