Home

Automated testing using GitHub Actions

Run your tests when you or your team make changes.


You can use the Supabase CLI to run automated tests.

Testing your database

After you have created unit tests for your database, you can use the GitHub Action to run the tests.

Inside your repository, create a new file inside the .github/workflows folder called database-tests.yml. Copy this snippet inside the file, and the action will run whenever a new PR is created:


_14
name: 'database-tests'
_14
on:
_14
pull_request:
_14
_14
jobs:
_14
build:
_14
runs-on: ubuntu-latest
_14
steps:
_14
- uses: actions/checkout@v3
_14
- uses: supabase/setup-cli@v1
_14
with:
_14
version: latest
_14
- run: supabase db start
_14
- run: supabase test db

Testing your Edge Functions

After you have created unit tests for your Edge Functions, you can use the GitHub Action to run the tests.

Inside your repository, create a new file inside the .github/workflows folder called functions-tests.yml. Copy this snippet inside the file, and the action will run whenever a new PR is created:


_17
name: 'functions-tests'
_17
on:
_17
pull_request:
_17
_17
jobs:
_17
build:
_17
runs-on: ubuntu-latest
_17
steps:
_17
- uses: actions/checkout@v3
_17
- uses: supabase/setup-cli@v1
_17
with:
_17
version: latest
_17
- uses: denoland/setup-deno@v2
_17
with:
_17
deno-version: latest
_17
- run: supabase start
_17
- run: deno test --allow-all deno-test.ts --env-file .env.local

More resources