🧪 Testing

CI Test Pipeline

Configure tests in the CI/CD pipeline.

GitHub Actions Test Workflow

name: Test Suite

on:
  pull_request:
    branches: [develop, main]
  push:
    branches: [develop]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [20.x]

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: "yarn"

      - run: yarn install --frozen-lockfile

      - name: Run Unit Tests
        run: yarn test --ci --coverage

      - name: Upload Coverage
        uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

  e2e-tests:
    runs-on: ubuntu-latest
    needs: unit-tests

    services:
      postgres:
        image: postgres:16
        env:
          POSTGRES_DB: gauzy_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: test
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "yarn"

      - run: yarn install --frozen-lockfile

      - name: Run E2E Tests
        run: yarn test:e2e
        env:
          DB_TYPE: postgres
          DB_HOST: localhost
          DB_PORT: 5432
          DB_NAME: gauzy_test
          DB_USER: postgres
          DB_PASS: test

Test Matrix

StageRuns OnDepends OnTimeout
Lintubuntu-latest—5 min
Unit Testsubuntu-latestLint15 min
E2E Testsubuntu-latestUnit Tests30 min
Buildubuntu-latestE2E Tests20 min

Caching

- uses: actions/cache@v4
  with:
    path: |
      node_modules
      .nx/cache
    key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}

Edit this page

Copyright © 2023-Present Ever Co. LTD.Docs by Sourcey