To run your tests in any CI, we recommend you simply run the following command:
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 Firebase emulators
- optionally, the Stripe Mock server
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 -e npm run dev:test & npm run stripe:mock-server & npm run cypress:headless sh scripts/kill-ports.sh
Let's explain it, so you can add your own modifications to it.
The first command will run (in parallel and in the background) the Next.js server and the Stripe mock server:
npm run dev:test & npm run stripe:mock-server &
Afterward, we execute the Cypress tests in headless mode:
npm run cypress:headless
Finally, we clean up all the ports that may have remained open after executing the script:
If you update your ports, remember to change them also in
Running the Tests in CI mode
Finally, the tests can be executed with the command
This command will automatically run the Firebase emulators and the
test.sh script, and is defined as:
"test": "firebase emulators:exec --project demo-makerkit --import ./firebase-seed \"sh ./scripts/test.sh\"",
When finished, the emulators will exit.