test/
├── tests.ts # Main test definitions (shared across presets)
├── fixture/ # Test fixture Nitro app
│ ├── nitro.config.ts
│ ├── routes/ # Test route handlers
│ ├── api/ # Test API handlers
│ ├── middleware/ # Test middleware
│ ├── plugins/ # Test plugins
│ └── public/ # Test static assets
├── presets/ # Per-preset test setup
│ ├── node.test.ts
│ ├── cloudflare.test.ts
│ ├── vercel.test.ts
│ └── ...
├── unit/ # Isolated unit tests
└── minimal/ # Minimal bundle output tests
test/tests.tsdefines shared test cases using vitest- Each
test/presets/<name>.test.tsimports shared tests and runs them against a specific preset - The test fixture in
test/fixture/is a full Nitro app used as the test target - Preset tests build the fixture with the preset, then run HTTP assertions
- Add test route/handler to
test/fixture/(e.g.,test/fixture/routes/new-feature.ts) - Add test case to
test/tests.ts - Run
pnpm vitest run test/presets/node.test.tsto verify
# Run all tests
pnpm test
# Run specific preset test
pnpm vitest run test/presets/node.test.ts
# Run unit tests
pnpm vitest run test/unit/
# Run minimal bundle test
pnpm vitest run test/minimal/- Write regression test in
test/fixture/+test/tests.ts - Confirm it fails (
pnpm vitest run test/presets/node.test.ts) - Fix the implementation
- Confirm it passes
- Run full suite (
pnpm test)