Testing
Vitest + Supertest para unit/integration e Playwright para E2E.
O PlazerCLI v3.1 suporta 2 frameworks de teste para garantir a qualidade do seu codigo.
Vitest + Supertest
Testes unitarios e de integracao HTTP com configuracao pronta.
// apps/api/tests/health.spec.ts
import { describe, it, expect } from 'vitest';
import request from 'supertest';
import { app } from '../src/app';
describe('Health Check', () => {
it('GET /api/health should return 200', async () => {
const res = await request(app).get('/api/health');
expect(res.status).toBe(200);
});
});
Script: pnpm test
Playwright
Testes end-to-end com Playwright. Gera config e teste de exemplo.
// e2e/home.spec.ts
import { test, expect } from '@playwright/test';
test('homepage loads', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/./);
});
Script: pnpm test:e2e