testing

Write and execute Vitest tests with Astro and Cloudflare bindings.

1|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/bluewaves-creations/website-foundation --skill testing-bluewaves-creations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/bluewaves-creations/website-foundation/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/bluewaves-creations/website-foundation --skill testing-bluewaves-creations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing, running, and managing tests for your project, ensuring code quality and stability.

Core Features & Use Cases

  • Vitest Integration: Leverages Vitest for fast unit and integration testing with Astro.
  • Cloudflare Mocking: Provides utilities to mock Cloudflare bindings (AI, Email, Secrets) for isolated testing.
  • API Route Testing: Enables testing of API endpoints by mocking requests and contexts.
  • Schema Validation: Facilitates testing of data schemas.
  • Use Case: You've just implemented a new API endpoint for user authentication. Use this Skill to write a comprehensive suite of tests that verify successful login, invalid credentials, and edge cases, ensuring the endpoint functions as expected.

Quick Start

Use the testing skill to run all tests in watch mode.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for Astro API routes?

Testing Astro API routes involves using Vitest to mock requests and contexts, allowing you to validate endpoint behavior like user authentication flows without deploying. This ensures your API functions as expected across edge cases.

How do I mock Cloudflare bindings in Vitest?

You can mock Cloudflare bindings in Vitest using provided test helpers like `createMockEnv` and `createMockContext` to create isolated testing environments. This supports mocking AI, Email, and Secrets bindings for your tests.

Does Vitest work with Astro for schema validation and integration testing?

Vitest integrates with Astro to provide fast unit and integration testing capabilities, including schema validation. This combination streamlines the process of writing and running tests to ensure code quality and stability.

What is the best way to test an Astro endpoint for invalid credentials?

The best way to test an Astro endpoint for invalid credentials is to write a comprehensive Vitest suite that mocks the API request context. This allows you to verify successful logins, invalid credentials, and edge cases efficiently.

Can I run Vitest in watch mode to automatically check my Astro project?

Yes, you can run Vitest in watch mode to automatically execute all tests in your Astro project. This provides fast feedback during development to ensure your code quality and stability are maintained.