Concurrent API tests using Vitest and @villedemontreal/concurrent-api-tests.
This template includes a dev container for a consistent development environment. To use it:
- Open this folder in VS Code
- When prompted, click "Reopen in Container" (or use the command palette:
Dev Containers: Reopen in Container) - Wait for the container to build and start
- Run
npm installandnpm start
The container includes Node.js and recommended VS Code extensions for API testing.
The example tests will fail until you connect them to a real API. See Adapting to Your Project below.
| Command | Description |
|---|---|
npm start |
Run tests against the current environment (alias for test-current) |
npm run test-current |
Run tests with NODE_ENV=localhost |
npm run test-latest-stable |
Run tests with NODE_ENV=dev for stable environment |
npm run watch-no-emit |
Type-check in watch mode without emitting .js files. Vitest directly works with .ts files. |
npm run lint-fix |
Format code with Prettier and fix ESLint issues |
npm run generate-api-client |
Generate typed API client from OpenAPI spec using Orval |
| Extension | Purpose |
|---|---|
.apiTests.ts |
Tests for a feature |
.apiTestSuite.ts |
Groups all tests to run concurrently |
.fixture.ts |
Common functions for tests |
.template.ts |
Default payload templates |
This template is ready to use out of the box, but you'll need to customize it for your API:
Update test/shared/apiUnderTest/open-api.yaml with your API's OpenAPI spec, then regenerate the client:
npm run generate-api-clientThis uses Orval to generate a typed API client. You can customize the generation in orval.config.cjs.
Edit the files in config/ to point to your API environments:
default.yaml— Base configurationlocalhost.yaml— Local development overridesdev.yaml— Dev/staging environment overrides
Edit test/shared/apiUnderTest/tooling/auth.sharedFixture.ts to implement actual authentication against your API. The template includes a placeholder that returns fake tokens.
Update config/default.yaml with your test user credentials. For secrets, use environment-specific files (config/local.yaml) that are not committed to git.
Replace the example in test/gettingStarted/ with your own features. Follow the Concurrent API Testing Guide for patterns and best practices.
This template includes Gherkin files in gherkin/ for the experimental AI-assisted workflow. Write natural language specifications in Gherkin format, then use AI agents to generate concurrent API tests.
- Concurrent API Testing Guide — Core methodology and patterns
- Library API Reference — Function documentation
- Writing Tests with AI Agents — Experimental AI-assisted workflow