CI Tests
Learn how to test your Makerkit in your CI
To run your tests in any CI, we recommend you simply run the following command:
npm test:e2e
This command takes care of running all the required services, importing the test data, executing the tests and then exiting.
The Makerkit testing pipeline
As mentioned in the previous section, testing a Makerkit requires a few services to be up and running:
- the Next.js server
- the Supabase environment
While executing these tests in your CI, this can get cumbersome. Therefore, we provided a single script to execute all your tests in one simple command: you can find the script at scripts/test.sh
, which will contain the following content:
set -enpm run supabase:start -- -x studio,migra,deno-relay,pgadmin-schema-diff,imgproxy &docker run --add-host=host.docker.internal:host-gateway --rm -it --name=stripe -d stripe/stripe-cli:latest listen --forward-to http://host.docker.internal:3000/api/stripe/webhook --skip-verify --api-key "$STRIPE_SECRET_KEY" --log-level debugnpm run dev:test &npm run cypress:headlessnpm run supabase:stop -- --no-backupexit 0
Let's explain it, so you can add your own modifications to it.
Running the Tests in CI mode
If you were to run the tests in CI mode, you would need to run the following command:
npm run supabase:startnpm run dev:test &npm run cypress
Then, you would need to stop the Supabase environment:
npm run supabase:stop
Since the DB gets updated, reset it to the initial state:
npm run supabase:reset