testing
Installation
SKILL.md
Testing — CAP Best Practices
Primary reference: https://cap.cloud.sap/docs/node.js/cds-test Vitest support (primary): https://cap.cloud.sap/docs/releases/2026/apr26
Recommended test runner: Vitest (CAP April 2026+)
cds.test now fully supports Vitest as a primary choice, while still maintaining compatibility with other test runners like Jest, Mocha, or Node's built-in test runner. Vitest is fully ESM compatible and recommended because Chai v6 (ESM) can no longer be fully provided in Jest runs — cds.test only provides a partial Chai emulation in Jest.
CDS 10+: New CAP projects are ESM-based by default (
"type": "module"inpackage.json). Useimportsyntax in test files. To create a CommonJS project, remove"type": "module"frompackage.json.
npm install --save-dev @cap-js/cds-test vitest