Tests
Unit Tests
The site source features a suite of unit tests that exercise the custom React components.
Tests are written using
- Vitest
- React Testing Library
- Storybook
Tests are run during local development, and during each build (preview environment on PR events, production environment on merge-to-main). For a production deployment, failing tests will halt the deployment.
Test results and coverage results for the latest production deployment are viewable from the website:
- unit test results (generated by XUnit-Viewer)
- coverage (Istanbul coverage metrics rendered via Vitest's coverage reporter)
Test results for a PR run are viewable at the equivalent URL within the preview evironment.
Istanbul is used for coverage in place of the Vitest default, V8, for its more precise branch detection.
CI Tests
The Docusaurus and Storybook content are built prior to any deployment (preview or production). If the build fails, the deployment is aborted. Output from a failure is viewable in GitHub actions
Future Plans
Linting, and Style
Future additions will add pre-commit linting checks, as well as spell-checks and prose checks (with Vale)
Component/Integration/E2E Tests
For now, Storybook (backed by unit tests) serves as an adequate test-bed for Component testing.
At present, this website depends on no back-end services or other integrations that require E2E or integration tests.
In the future, this site will explore incorporating some external API calls as a means to automate documentation as much as possible. At that time, the testing approach will be expanded to include more testing categories.