Nest has three test suites: a backend test suite powered by pytest, and a frontend test suite with both unit/accessibility tests (Jest) and end-to-end tests (Playwright). All suites run automatically in CI against every pull request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/owasp/nest/llms.txt
Use this file to discover all available pages before exploring further.
Running all tests
Backend tests
Stack
| Tool | Purpose |
|---|---|
| pytest | Test runner |
| pytest-django | Django integration for pytest |
| pytest-mock | mocker fixture for mocking |
| pytest-cov | Coverage measurement |
| pytest-xdist | Parallel test execution |
Running backend tests
backend/pyproject.toml, including parallel execution (--numprocesses=auto) and coverage reporting.
Coverage requirement
The backend enforces a 95% minimum coverage threshold (--cov-fail-under=95). Coverage is measured with branch coverage enabled and excludes migrations, __init__.py files, settings, and test files themselves.
A coverage report is printed to the terminal and also written to coverage.xml. If your changes reduce coverage below 95%, the build fails.
To check coverage for a specific module:
Test organisation
Backend tests live underbackend/tests/apps/ and mirror the backend/apps/ directory structure:
Writing backend tests
Frontend tests
Stack
| Tool | Purpose |
|---|---|
| Jest | Unit and accessibility test runner |
| Playwright | End-to-end browser tests |
| schemathesis | API fuzz testing |
Unit tests
Unit tests live underfrontend/__tests__/unit/ and cover components, hooks, utilities, and page logic.
frontend/jest.config.ts enforces a minimum coverage threshold. Ensure your changes do not reduce overall frontend coverage.
Accessibility tests
Accessibility (a11y) tests live underfrontend/__tests__/a11y/ and verify that pages and components meet WCAG standards.
End-to-end tests
Playwright e2e tests live underfrontend/__tests__/e2e/ and test full user journeys in a real browser.
To run e2e tests (this starts the full backend stack automatically):
http://localhost:3800.
Fuzz tests
Nest uses schemathesis to fuzz-test the REST API against its OpenAPI schema. Fuzz tests live underbackend/tests/fuzz/.
Security scanning
Run Semgrep and Trivy scans locally before pushing:# NOSEMGREP comments with an explanation to suppress confirmed false positives.
Adding tests for new functionality
- Backend: add test files under
backend/tests/apps/<app_name>/mirroring the source structure. - Frontend unit: add test files under
frontend/__tests__/unit/next to the component or hook being tested. - Frontend a11y: add a11y test files under
frontend/__tests__/a11y/for any new pages or interactive components.
