Claude Code Plugins

Community-maintained marketplace

Feedback

svelte-testing

@spences10/sveltest
86
0

Fix and create Svelte 5 tests with vitest-browser-svelte and Playwright. Use when fixing broken tests, debugging failures, writing unit/SSR/e2e tests, or working with vitest/Playwright.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name svelte-testing
description Fix and create Svelte 5 tests with vitest-browser-svelte and Playwright. Use when fixing broken tests, debugging failures, writing unit/SSR/e2e tests, or working with vitest/Playwright.

Svelte Testing

Quick Start

// Client-side component test (.svelte.test.ts)
import { render } from 'vitest-browser-svelte';
import { expect } from 'vitest';
import Button from './button.svelte';

test('button click increments counter', async () => {
	const { page } = render(Button);
	const button = page.getByRole('button', { name: /click me/i });

	await button.click();
	await expect.element(button).toHaveTextContent('Clicked: 1');
});

Core Principles

  • Always use locators: page.getBy*() methods, never containers
  • Multiple elements: Use .first(), .nth(), .last() to avoid strict mode violations
  • Use untrack(): When accessing $derived values in tests
  • Real API objects: Test with FormData/Request, minimal mocking

Reference Files

Notes

  • Never click SvelteKit form submit buttons - Always use await expect.element()
  • Test files: .svelte.test.ts (client), .ssr.test.ts (SSR), server.test.ts (API)