How we’ve configured testing in zopio
.
zopio
uses Vitest for unit testing. It’s a fast and lightweight testing framework that’s compatible with Jest’s API. Unit tests are run automatically as part of the build
task in Turborepo.
__tests__
folder in each app, however we’ve only written a couple of tests for app
project so far.
__tests__
folder, create a new file called [page].test.tsx
(where [page]
is the name of the page you want to test). Here’s an example of a test for the home
page:
@repo/testing
package to the devDependencies
section of the package.json
file:
vitest.config.ts
in the root of the app and add the following:
__tests__
folder in the relevant app and add a test
command to the package.json
file:
test
script and run the tests.
Then, just follow the instructions above to write tests.