-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5994498
commit fc8dc29
Showing
3 changed files
with
8 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1 @@ | ||
# Testing | ||
|
||
We use [vitest](https://vitest.dev/) for testing library code. | ||
|
||
Configuring this properly was tricky. Since the library heavily relies on browser APIs like web workers & wasm, it doesn't really make sense to mock the browser APIs for unit tests. To trust our tests in this library, we really need them to run in a realistic browser environment. | ||
|
||
Vitest browser mode + playwright (provider) seems to satisfy all our needs. It spins up a real browser to run tests and can run headlessly for CI. I had to add one hack to make it work with the web-worker, but otherwise it seems to work well out of the box. | ||
|
||
This framework should be suitable for all the additional libraries we have planned (e.g. react). | ||
|
||
## Usage | ||
|
||
```bash | ||
# in the root of the repo | ||
pnpm run test | ||
``` | ||
Check out the [testing docs](https://web.fedimint.org/core/dev/testing) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters