testing.mdx27 lines · 1006 B · raw
1---
2title: Testing
3layout: ../../layouts/MainLayout.astro
4---
5
6# Testing
7
8Strudel uses [vitest](https://vitest.dev/) for testing, with 2 types of testing strategies:
9
10- unit tests for fine grained testing
11- automated snapshot tests for broader testing
12
13## Unit Tests
14
15Each 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`.
16
17## Snapshot Tests
18
19Snapshot tests allow testing larger chunks of data. Strudel uses snapshot tests for:
20
21- Example Snippets: `examples.test.mjs`, using snippets under `@example` inside jsdoc comments
22- Example Tunes: `tunes.test.mjs`, using all patterns in `tunes.mjs`
23
24The snapshot (`.snap`) files contain all haps within a certain number of cycles for each tested pattern.
25They allow testing for breaking changes on a larger scale.
26If breaking changes are intentional, the snapshots can be updated with `npm run snapshot`.
27Just make sure to verify that all affected patterns behave as expected.