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

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/, which will contain the following content:

set -e npm run dev:test & npm run stripe:mock-server & npm run cypress:headless sh scripts/

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:

sh scripts/

If you update your ports, remember to change them also in scripts/

Running the Tests in CI mode

Finally, the tests can be executed with the command npm test.

This command will automatically run the Firebase emulators and the script, and is defined as:

"test": "firebase emulators:exec --project demo-makerkit --import ./firebase-seed \"sh ./scripts/\"",

When finished, the emulators will exit.

Subscribe to our Newsletter
Get the latest updates about React, Remix, Next.js, Firebase, Supabase and Tailwind CSS