Coexists with Mocha (kept for unit-style tests) and Cypress (unchanged, web e2e). Adds: - apps/api/features/*.feature — Gherkin scenarios - apps/api/features/step-definitions/*.steps.ts — step implementations - apps/api/features/support/world.ts — per-scenario World, spins up the Express app in-process via createApp() + supertest (no real server needed, same approach as the existing Mocha health test) - apps/api/cucumber.cjs — config, deliberately .cjs (not .js) to avoid the same ESM/CJS config-loading mismatch that broke apps/web/cypress.config.ts earlier - `test:bdd` script (cross-env + tsx via NODE_OPTIONS=--import=tsx, for cross-platform ESM+TS loading) - health.feature/steps as a working example, mirroring the existing Mocha health test so both suites cover the same behavior in their respective styles CI: runs `pnpm --filter api test:bdd` alongside the existing test step. README: documents the new test layer and the TS/ESM config-loading caveat for future tool configs. Verified locally: lint, mocha, cucumber, and full build all pass.
52 lines
1.2 KiB
YAML
52 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
lint-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm lint
|
|
- run: pnpm --filter api test
|
|
- run: pnpm --filter api test:bdd
|
|
- run: pnpm build
|
|
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
needs: lint-and-test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Cache Cypress binary
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/Cypress
|
|
key: cypress-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
# pnpm install doesn't reliably trigger Cypress's postinstall binary
|
|
# download (see apps/web's cypress caveat in the README) — install it
|
|
# explicitly so `cypress run` finds it.
|
|
- run: pnpm --filter web exec cypress install
|
|
- run: pnpm --filter web e2e
|