diff --git a/.github/workflows/frontend-test.yml b/.github/workflows/frontend-test.yml new file mode 100644 index 00000000..36bba77c --- /dev/null +++ b/.github/workflows/frontend-test.yml @@ -0,0 +1,29 @@ +name: Test Frontend + +on: + push: + branches: + - main + pull_request: + +jobs: + node-test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - uses: actions/setup-node@v7 + with: + node-version: 24 + # Pin npm >= 11.16 so the v12 install defaults in .npmrc are enforced + # regardless of the npm bundled with Node. (--engine-strict=false so this + # bootstrap step itself isn't gated by package.json "engines".) + - name: Upgrade npm to enforce npm v12 install defaults + run: npm install -g npm@11.16.0 --engine-strict=false + - name: Install dependencies + run: npm ci + - name: Run vitest + # `vitest run` does a single pass and exits (the npm "test" script runs + # in watch mode, which would hang CI). + run: npx vitest run diff --git a/Makefile b/Makefile index 8aeb4ed8..013bc6e3 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,9 @@ help: @echo " make pytest-postgres pytest against a disposable postgres:16 container" @echo " make ruff ruff check + ruff format --check" @echo " make ty ty check" - @echo " make test ruff + ty + pytest" + @echo " make test-backend ruff + ty + pytest" + @echo " make test-frontend vitest (frontend unit tests, single run)" + @echo " make test test-backend + test-frontend (everything)" @echo "" @echo "Other:" @echo " make dev Sync deps into .venv via uv (idempotent)" @@ -236,5 +238,12 @@ ruff: dev uv run ruff check . uv run ruff format --check . +.PHONY: test-backend +test-backend: ruff ty pytest + +.PHONY: test-frontend +test-frontend: + npm install && npx vitest run + .PHONY: test -test: ruff ty pytest +test: test-backend test-frontend