---
title: "Test your app"
description: "Which test fits which change: backend functions in convex-test, pages over a mock backend, the real app end to end with Playwright, all of it in CI, and a load test before launch."
canonical_url: "https://nuxt-backend.dev/docs/develop/testing"
---
# Test your app

> Which test fits which change: backend functions in convex-test, pages over a mock backend, the real app end to end with Playwright, all of it in CI, and a load test before launch.

Version: nuxt-backend 0.6.x · Tab: Develop · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Test each change at the lowest level that can catch its bug. Most tests run with no deployment and no provider, in milliseconds. A few drive the real app on the providers' test modes.

- **What powers it natively:** Vitest, Convex's `convex-test`, `@nuxt/test-utils`, Playwright, and the providers' test modes: Resend's test addresses and Polar's sandbox.
- **What the package adds:** `nuxt-backend/test` signs callers in for `convex-test`, `nuxt-backend/test-utils` puts a mock backend under your pages, and `npx nuxt-backend inbox --json` hands an end-to-end test its sign-in code.

## Pick the level

<table>
<thead>
  <tr>
    <th>
      You changed
    </th>
    
    <th>
      Test it with
    </th>
    
    <th>
      Needs
    </th>
    
    <th>
      Page
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      A query, a mutation or an action
    </td>
    
    <td>
      <code>
        convex-test
      </code>
      
      , signed in as a person in a workspace
    </td>
    
    <td>
      Nothing
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/functions">
        Test backend functions
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      A page or a component
    </td>
    
    <td>
      A mock backend and session in Vitest
    </td>
    
    <td>
      Nothing
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/pages">
        Test pages over a mock backend
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      An email's wording or language
    </td>
    
    <td>
      <code>
        renderEmail
      </code>
    </td>
    
    <td>
      Nothing
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/pages#test-your-emails">
        Test your emails
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      A flow across pages, sign-in or a purchase
    </td>
    
    <td>
      Playwright, on a dev deployment
    </td>
    
    <td>
      A Resend key in test mode, a Polar sandbox token
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/e2e">
        Run end-to-end tests
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      Anything, before it merges
    </td>
    
    <td>
      All of the above on every pull request
    </td>
    
    <td>
      Two CI secrets, for end to end
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/ci">
        Check every change in CI
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      The busiest paths, before launch
    </td>
    
    <td>
      k6, on a deployment made for the test
    </td>
    
    <td>
      A Convex project for the test
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/load">
        Load-test before launch
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      Code style in <code>
        backend/
      </code>
    </td>
    
    <td>
      Convex's lint rules
    </td>
    
    <td>
      Nothing
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/develop/testing/linting">
        Lint backend functions
      </a>
    </td>
  </tr>
</tbody>
</table>

## One Vitest config for both

Function tests run in Convex's edge runtime, and page tests in a Nuxt environment. Give each its own project in one config, so `npx vitest run` runs both:

```ts [vitest.config.ts]
import { defineConfig } from 'vitest/config'
import { defineVitestProject } from '@nuxt/test-utils/config'
import { backendTestAliases } from 'nuxt-backend/test-utils'

export default defineConfig({
  test: {
    projects: [
      {
        test: {
          name: 'backend',
          include: ['backend/**/*.test.ts'],
          environment: 'edge-runtime',
        },
      },
      await defineVitestProject({
        resolve: { alias: backendTestAliases() },
        test: {
          name: 'app',
          include: ['test/app/**/*.test.ts'],
          environment: 'nuxt',
          environmentOptions: { nuxt: { domEnvironment: 'happy-dom' } },
        },
      }),
    ],
  },
})
```

Each page lists what to install for its half. Playwright keeps its own config and runs with `npx playwright test`.

## Why most tests need no provider

A test that calls Polar or Resend is slow, needs a key and can fail for reasons outside your code. So the function and page tests replace the deployment: `convex-test` runs your functions in memory, and the mock answers your pages. The end-to-end suite is the one place a run crosses a provider, and the providers' test modes keep it from sending real mail or taking real money.

The test helpers are experimental ([Stability](https://nuxt-backend.dev/docs/ship/releases/stability#the-experimental-tier)): they follow the auth and billing flows, which may still move.

## Related

- [Test backend functions](https://nuxt-backend.dev/docs/develop/testing/functions): `convex-test` with the package's components.
- [Test pages over a mock backend](https://nuxt-backend.dev/docs/develop/testing/pages): every state a page can be in.
- [Run end-to-end tests](https://nuxt-backend.dev/docs/develop/testing/e2e): Playwright, codes from the dev inbox, the test card.
- [Develop on real sandboxes](https://nuxt-backend.dev/docs/develop/sandboxes): the providers' test modes the end-to-end suite uses.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
