Skip to content

Testing Guide ​

Source: extracted from project README, 2026-05-25.

Six Vitest projects defined in vitest.config.ts — each with its own include pattern, environment, and prerequisites:

ProjectCommandBacking store / targetUse
unitnpm testIn-memory SQLite (mock auth)Default fast suite — pure-fn, parsers, CDS handlers, shared srv/lib/ modules. Watch mode via npm run test:watch
hybridnpm run test:hybridReal prod HDI via cds bind --execSchema deploy, HANA sequences, views, developer workflow, admin CRUD, search, vector round-trip, recommendations, audit/feedback. Requires cf login to DEV
hybrid-qacds bind --exec -- npx vitest run --project hybrid-qaReal QA HDI (hana-tutorials-db-qa)Author-channel parity tests; uses pool: 'forks' + _guard.js write protection
smokenpm run test:smokeDeployed approuter + srv over HTTPHealth, public endpoints, auth enforcement, OData metadata, content serve, search, WebSocket handshake, redirects, SEO/JSON-LD, QA routes. Set SMOKE_BASE_URL + SMOKE_SRV_URL
a11ynpm run test:a11yDeployed approuter (Lighthouse CI)WCAG smoke; full Lighthouse via npm run test:a11y:lighthouse, summary via npm run test:a11y:summary
e2enpm run test:e2eDeployed approuter (Playwright, headless Chromium)Admin-UI browser smoke — one happy path per UI surface (tutorial serve, admin-shell, scanner, analytics-explorer, display-app). Post-deploy non-gating. Set SMOKE_BASE_URL (or PLAYWRIGHT_BASE_URL) + SMOKE_TECH_USER/SMOKE_TECH_PASSWORD. Self-skips when env absent. See test/e2e/README.md

npm run test:all runs the full matrix under cds bind --exec (so hybrid + hybrid-qa get real bindings).

Hybrid write safety ​

test/hybrid/_guard.js (and the hybrid-qa setup file) check ALLOW_HYBRID_WRITES=true before any INSERT/UPDATE/DELETE. Test data is prefixed with __TEST__ and removed in afterAll. The guard exists because hybrid suites hit the same DEV HDI that powers the deployed app — a leaked write is a real write.

Layout ​

  • test/unit/, test/lib/, test/jobs/, test/parsers/, test/integration/, test/srv-qa/ — picked up by unit (also pulls srv/**/__tests__/, scripts/__tests__/, and app/analytics-explorer/src/**/__tests__/)
  • test/hybrid/ — 17 hybrid suites
  • test/hybrid-qa/ — QA-channel parity
  • test/smoke/ — 26 smoke suites; CI runs them automatically after deploy via .github/workflows/deploy.yml
  • test/a11y/ — Lighthouse CI config + summary script
  • test/e2e/ — Playwright admin-UI smoke specs (sixth project, #1338); see test/e2e/README.md
  • test/fixtures/ — Shared fixture data (no test files)

Running a single file ​

bash
npx vitest run test/lib/mail-client.test.js                 # one unit file
npx vitest run --project smoke test/smoke/health.test.js    # one smoke file
cds bind --exec -- npx vitest run test/hybrid/views.test.js # one hybrid file