52 - Pin npm to 11.17.0 and gate e2e on frontend healthcheck

This commit is contained in:
myrmidex 2026-06-28 18:18:01 +02:00
parent 314a977ced
commit fa3732a0ac
3 changed files with 20 additions and 4 deletions

View file

@ -43,12 +43,23 @@ services:
- frontend_node_modules:/app/node_modules - frontend_node_modules:/app/node_modules
ports: ports:
- "${VITE_PORT:-5173}:5173" - "${VITE_PORT:-5173}:5173"
command: sh -c "npm install && npm run dev -- --host 0.0.0.0 --port 5173" # Pin npm to the version in package.json's `packageManager` field (the
# image's bundled npm is older; corepack doesn't reliably repoint npm).
command: sh -c "npm install -g npm@11.17.0 && npm install && npm run dev -- --host 0.0.0.0 --port 5173"
depends_on: depends_on:
- php - php
environment: environment:
# Reliable file-watching under the bind-mount. # Reliable file-watching under the bind-mount.
CHOKIDAR_USEPOLLING: "true" CHOKIDAR_USEPOLLING: "true"
# Marks the service healthy only once Vite is actually serving — the e2e
# runner waits on this (condition: service_healthy) to avoid racing startup.
# start_period covers the slow first boot (global npm install + npm install).
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:5173/"]
interval: 5s
timeout: 3s
retries: 5
start_period: 90s
tty: true tty: true
# Playwright e2e runner (browsers + libs preinstalled). On-demand only — opt # Playwright e2e runner (browsers + libs preinstalled). On-demand only — opt
@ -67,9 +78,12 @@ services:
# Target the SPA by compose service name, not localhost. # Target the SPA by compose service name, not localhost.
E2E_BASE_URL: "http://frontend:5173" E2E_BASE_URL: "http://frontend:5173"
depends_on: depends_on:
- frontend # Wait until Vite is actually serving, not just the container started.
# Install deps then run the suite; the image already has the browsers. frontend:
command: sh -c "npm install && npm test" condition: service_healthy
# Pin npm to match package.json's `packageManager`; the image already has
# the browsers. Then install deps + run the suite.
command: sh -c "npm install -g npm@11.17.0 && npm install && npm test"
###> symfony/mercure-bundle ### ###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ### ###< symfony/mercure-bundle ###

View file

@ -1,6 +1,7 @@
{ {
"name": "buckets-e2e", "name": "buckets-e2e",
"private": true, "private": true,
"packageManager": "npm@11.17.0",
"description": "Playwright end-to-end smoke tests. Runs in the `playwright` compose service (browsers preinstalled) against the live stack, targeting frontend:5173. NOTE: @playwright/test version must match the image tag in compose.override.yaml.", "description": "Playwright end-to-end smoke tests. Runs in the `playwright` compose service (browsers preinstalled) against the live stack, targeting frontend:5173. NOTE: @playwright/test version must match the image tag in compose.override.yaml.",
"type": "module", "type": "module",
"scripts": { "scripts": {

View file

@ -3,6 +3,7 @@
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"packageManager": "npm@11.17.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",