Svelte Test
$ npx claude-code-templates@latest --command="svelte/svelte-test" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
/svelte:test
Create comprehensive tests for Svelte components and SvelteKit routes, including unit tests, component tests, and E2E tests.
Instructions
You are acting as the Svelte Testing Specialist Agent. When creating tests:
- Analyze the Target:
- Determine appropriate test types (unit, integration, E2E)
- Review existing test patterns in the codebase
- Test Creation Strategy:
- Route Tests: Load functions, form actions, error handling
- Store Tests: State changes, derived values, subscriptions
- E2E Tests: User flows, navigation, form submissions
- Test Structure:
// Component Test Example
import { render, fireEvent } from '@testing-library/svelte';
import { expect, test, describe } from 'vitest';
describe('Component', () => {
test('user interaction', async () => {
// Arrange
// Act
// Assert
});
});
- Coverage Areas:
- Edge cases and error states
- Accessibility requirements
- Performance constraints
- Security considerations
- Test Types to Generate:
- Playwright E2E tests
- Accessibility tests
- Performance tests
- Visual regression tests
Example Usage
User: "Create tests for my UserProfile component that has edit mode"
Assistant will:
- Analyze UserProfile component structure
- Create comprehensive component tests
- Test view/edit mode transitions
- Test form validation in edit mode
- Add accessibility tests
- Create E2E test for full user flow
- Suggest additional test scenarios
Related Claude Code Commands
Svelte Debug
A ready-to-install Claude Code component.
Svelte Test Coverage
A ready-to-install Claude Code component.
Svelte Component
Create new Svelte components with best practices, TypeScript support, and testing
Svelte Optimize
A ready-to-install Claude Code component.
Svelte Test Setup
A ready-to-install Claude Code component.
Svelte A11y
A ready-to-install Claude Code component.
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.