DEV Community

Will Ceolin
Will Ceolin

Posted on

How to use stripe-mock with GitHub Actions

stripe-mock is a library that allows you to mock the Stripe API. It's useful for testing purposes when you don't want to make requests to the actual API.

You can also use it with GitHub Actions on the testing pipeline for your CI environment.

stripe-mock has a Docker image you can use on GitHub Actions: stripe/stripe-mock.

This allows us to use service containers to run the mock server:

jobs:

  test:
    runs-on: ubuntu-latest

    services:
      stripemock:
        image: stripe/stripe-mock:latest
        ports: ['12111:12111']
Enter fullscreen mode Exit fullscreen mode

That's it! Now the mock Stripe API will be running on port 12111 when you run your tests on GitHub Actions.

Top comments (0)