batchCooking/apps/api/cucumber.cjs
Nicolas 47e0477c40 Add Cucumber for readable BDD-style integration tests (apps/api)
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.
2026-08-16 11:05:20 +02:00

11 lines
416 B
JavaScript

// Explicit .cjs extension (not .js) so this loads as CommonJS regardless of
// the "type": "module" in package.json — avoids the same ESM/CJS config
// loader mismatch that broke apps/web/cypress.config.ts earlier.
module.exports = {
default: {
paths: ["features/**/*.feature"],
import: ["features/**/*.ts"],
format: ["progress-bar"],
formatOptions: { snippetInterface: "async-await" },
},
};