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 Remix server
- the Supabase dev 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 -d stripe/stripe-cli:latest listen --forward-to http://host.docker.internal:3000/resources/stripe/webhook --skip-verify --api-key "$STRIPE_SECRET_KEY" --log-level debugdotenv -e .env.test npm run builddotenv -e .env.test npm run start &dotenv -e .env.test npm run cypress:headlessnpm run supabase:stop -- --no-backupexit 0
Running the Tests in CI mode
If you were to run the tests in CI mode, you would need to run the following command:
dotenv -e .env.test npm run test:remix &dotenv -e .env.test npm run cypress:headless
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