mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-14 07:08:30 +00:00
28 lines
1006 B
Plaintext
28 lines
1006 B
Plaintext
---
|
|
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.
|