apps/docs/contributing/development-workflow/2-running-tests.mdx
For testing, we use vitest. We prefer to define globals and run tests under the happy-dom environment.
We do not strictly enforce testing coverage, but encourage it. A good rule of thumb is that if you need to simulate use cases to check whether a specific portion of code works, you should split it into a function with a matching unit test.
After you have gone through the setup run
pnpm test inside any package. This will run the tests only once. We have two
scripts defined on our packages for testing:
pnpm test: Runs all the tests once. If you run it on the root, it will run the
tests for all packages using
turborepopnpm test:watch: Runs all the tests and watches for changes. Vitest
automatically only runs the tests that are affected by the code you've
changed.