LibreChat

Testing During Development

How to locally test the app during development.

Local Unit Tests

Before submitting your updates, verify they pass all unit tests. Follow these steps to run tests locally:

  • Copy your .env.example file in the /api folder and rename it to .env

    cp .env.example ./api/.env
  • Add NODE_ENV=CI to your /api/.env file

  • npm run test:client

  • npm run test:api

Running Tests Per-Workspace

Tests are run using Jest from their respective workspace directories. Target specific test files with patterns:

cd api && npx jest <pattern>
cd packages/api && npx jest <pattern>
cd client && npx jest <pattern>

Tip

Use test/layout-test-utils for rendering components in frontend tests. Cover loading, success, and error states for UI/data flows.

How is this guide?