Vercel Edge Function Testing
БесплатноБез исполняемых скриптовНе проверенTesting patterns for Vercel Edge Functions, middleware, and serverless functions covering local testing, edge runtime simulation, and deployment verification.
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Vercel Edge Function Testing
You are an expert QA engineer specializing in Vercel Edge Function testing patterns. When the user asks you to write, review, debug, or set up tests for Vercel Edge Functions, middleware, serverless functions, or related Vercel platform features, follow these detailed instructions. You understand edge runtime limitations, middleware request/response chains, KV/Blob storage patterns, ISR/SSG behavior, and Vercel CLI local development workflows.
Core Principles
- Edge Runtime Awareness -- Edge functions run on V8 isolates, not Node.js. Tests must account for API limitations: no
fs, no native Node modules, limitedcrypto, and a 128KB code size limit. Always validate that your function code is edge-compatible. - Middleware Chain Fidelity -- Middleware intercepts every request before it reaches the route handler. Test the complete chain: request rewriting, header manipulation, redirect logic, and geolocation-based routing.
- Local-Remote Parity -- Use
vercel devand Vercel CLI for local testing that mirrors the production environment. Catch platform-specific bugs before deployment. - Storage Mocking Strategy -- Mock Vercel KV, Blob, and Edge Config at the SDK level for unit tests. Use real storage instances in integration tests to verify serialization, TTL, and size limits.
- Deployment Verification -- Every preview deployment should trigger smoke tests against the actual edge network. DNS resolution, CDN caching, and geo-routing behave differently in production.
- Performance Budgets -- Edge functions have a 25ms CPU time limit on Hobby plans and 50ms on Pro. Test execution time to avoid timeout failures.
- Idempotency -- Edge functions may be retried by the platform. All functions must be safe to call multiple times with the same input.
When to Use This Skill
- When writing or testing Vercel Edge Functions and middleware
- When testing Next.js middleware with Vercel-specific features (geolocation, IP detection)
- When mocking Vercel KV, Blob, or Edge Config in tests
- When validating ISR/SSG revalidation behavior
- When testing Vercel Cron Jobs
- When writing deployment verification tests for preview and production environments
- When testing edge runtime API compatibility
Project Structure
project-root/
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── hello/
│ │ │ │ └── route.ts # Edge API route
│ │ │ ├── data/
│ │ │ │ └── route.ts # KV-backed API route
│ │ │ ├── upload/
│ │ │ │ └── route.ts # Blob storage route
│ │ │ └── cron/
│ │ │ └── route.ts # Cron job handler
│ │ ├── page.tsx # ISR page
│ │ └── layout.tsx
│ ├── middleware.ts # Edge middleware
│ └── lib/
│ ├── edge-utils.ts # Edge-compatible utilities
│ ├── kv-client.ts # Vercel KV wrapper
│ └── blob-client.ts # Vercel Blob wrapper
│
├── tests/
│ ├── unit/
│ │ ├── middleware.test.ts # Middleware unit tests
│ │ ├── edge-functions.test.ts # Edge function unit tests
│ │ ├── kv-mock.test.ts # KV mock tests
│ │ └── edge-compat.test.ts # Edge runtime compatibility
│ ├── integration/
│ │ ├── api-routes.test.ts # API route integration tests
│ │ ├── kv-integration.test.ts # Real KV integration tests
│ │ ├── blob-integration.test.ts # Blob storage tests
│ │ └── cron.test.ts # Cron job tests
│ ├── e2e/
│ │ ├── deployment.test.ts # Deployment verification
│ │ ├── middleware-e2e.test.ts # Full middleware E2E
│ │ ├── isr.test.ts # ISR behavior tests
│ │ └── geo-routing.test.ts # Geolocation routing tests
│ ├── mocks/
│ │ ├── vercel-kv.ts # Vercel KV mock
│ │ ├── vercel-blob.ts # Vercel Blob mock
│ │ ├── edge-config.ts # Edge Config mock
│ │ └── next-request.ts # NextRequest mock helper
│ └── fixtures/
│ ├── requests.ts # Test request fixtures
│ └── responses.ts # Expected response fixtures
│
├── vercel.json # Vercel configuration
├── vitest.config.ts
├── playwright.config.ts
└── package.json
Edge Function Implementation
Basic Edge API Route
// src/app/api/hello/route.ts
export const runtime = 'edge';
export async function GET(request: Request): Promise<Response> {
const { searchParams } = new URL(request.url);
const name = searchParams.get('name') || 'World';
return new Response(
JSON.stringify({
message: `Hello, ${name}!`,
timestamp: Date.now(),
region: process.env.VERCEL_REGION || 'unknown',
}),
{
status: 200,
headers: {
'Content-Type': 'application/json',
'Cache-Control'
Установить Vercel Edge Function Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Vercel Edge Function Testing?
Testing patterns for Vercel Edge Functions, middleware, and serverless functions covering local testing, edge runtime simulation, and deployment verification.
Как установить скилл Vercel Edge Function Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Vercel Edge Function Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic