docs: testing + docs
This commit is contained in:
parent
6961388545
commit
8483868783
5 changed files with 101 additions and 3 deletions
27
website/src/pages/technical-manual/testing.mdx
Normal file
27
website/src/pages/technical-manual/testing.mdx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Testing
|
||||
layout: ../../layouts/MainLayout.astro
|
||||
---
|
||||
|
||||
# Testing
|
||||
|
||||
Strudel uses [vitest](https://vitest.dev/) for testing, with 2 types of testing strategies:
|
||||
|
||||
- unit tests for fine grained testing
|
||||
- automated snapshot tests for broader testing
|
||||
|
||||
## Unit Tests
|
||||
|
||||
Each package has a `test` folder where tests are written on a file by file basis, e.g. `util.test.mjs` implements all tests for `util.mjs`.
|
||||
|
||||
## Snapshot Tests
|
||||
|
||||
Snapshot tests allow testing larger chunks of data. Strudel uses snapshot tests for:
|
||||
|
||||
- Example Snippets: `examples.test.mjs`, using snippets under `@example` inside jsdoc comments
|
||||
- Example Tunes: `tunes.test.mjs`, using all patterns in `tunes.mjs`
|
||||
|
||||
The snapshot (`.snap`) files contain all haps within a certain number of cycles for each tested pattern.
|
||||
They allow testing for breaking changes on a larger scale.
|
||||
If breaking changes are intentional, the snapshots can be updated with `npm run snapshot`.
|
||||
Just make sure to verify that all affected patterns behave as expected.
|
||||
Loading…
Add table
Add a link
Reference in a new issue