diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh index eb5d0cdf44..d25de39044 100755 --- a/scripts/tests/test-hot-dev-bg.sh +++ b/scripts/tests/test-hot-dev-bg.sh @@ -834,21 +834,22 @@ test_root_playwright_wrapper_prefers_managed_browser_runtime() { } EOF - # The root playwright.config.ts imports @playwright/test, which is a - # devDependency of tests/integration/ — not installed in environments - # that haven't run the integration-tests setup (CI smoke job, fresh - # clones). Skip the wrapper-behavior assertion in those environments - # rather than blow up on a missing module. - if ! (cd "${ROOT_DIR}" && node -e "require.resolve('@playwright/test')") >/dev/null 2>&1; then - echo "[SKIP] root-playwright wrapper check (@playwright/test not installed)" - return 0 - fi - - output="$( + # 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="$( cd "${ROOT_DIR}" && \ PULSE_E2E_RUNTIME_STATE_PATH="${runtime_state}" \ - npx tsx --eval "import config from './playwright.config.ts'; console.log(config.use?.baseURL || '');" - )" + 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}...)" + return 0 + fi assert_contains "root playwright wrapper prefers runtime-state browser url" "${output}" "http://127.0.0.1:5173" assert_not_contains "root playwright wrapper no longer falls back to embedded frontend by default" "${output}" "http://localhost:7655"