Pre-check integration node_modules before root-playwright wrapper assertion

This commit is contained in:
rcourtman 2026-05-12 01:05:54 +01:00
parent 216b3cae38
commit 8e49e68393

View file

@ -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