Email Testing with Vitest

How to test email flows in Vitest using disposable inboxes. TypeScript-native, fast HMR-aware tests. Create temp inboxes, poll for emails, assert content via REST API.

Frequently Asked Questions

Can I use the sed.sh Inbox API with Vitest?

Yes. Vitest is Jest-compatible, so the @sed-sh/sdk works identically. Install it with npm install @sed-sh/sdk --save-dev and use the same inbox helpers.

Does Vitest require any special setup for email testing?

Just set testTimeout: 60000 in vitest.config.ts so your poll loops have enough time. No special plugin or Babel transform needed — Vitest handles TypeScript natively.

What is the difference between Vitest and Jest for email testing?

The sed.sh SDK code is identical. Vitest is faster and has zero-config TypeScript for Vite projects. If you already use Vite, Vitest is the natural choice.

How do I run Vitest email tests in CI?

Add SED_SH_API_KEY to your CI secrets (e.g., GitHub Actions → Settings → Secrets) and run npx vitest run. Set env.SED_SH_API_KEY: ${{ secrets.SED_SH_API_KEY }} in the workflow step.

How much do email tests cost?

$0.0012 per email for the first 5,000, $0.0008 for 5,001–10,000, and $0.0005 for 10,001+. A $10 deposit gets you ~8,300 tests at the first tier.

Do I need to mock anything?

No. Your app sends to a real @sed.sh address. sed.sh receives it on its own MX servers and you read it via REST API. No fake SMTP, no Mailhog container, no mocking.