Index of every page on this site: llms.txt
All skills
fubits1 avatar

/testing-svelte

@a024d57
by Iljafubits1/svelte-skills11 stars
2
Run it yourself

Fix or write Svelte 5 tests with vitest-browser-svelte and Playwright. Use when debugging broken or flaky tests, 'Cannot connect to the iframe', strict mode violations, or writing unit/SSR/e2e tests.

Use this Skill: https://skilld.dev/gh/fubits1/svelte-skills/testing-svelte

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesserver-ssr-examples.md

≈379 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Server & SSR Test Examples

SSR Test

Test server-side rendering output:

// page.ssr.test.ts
import { test, expect, describe } from 'vitest';
import { render } from 'svelte/server';
import PageComponent from './+page.svelte';

describe('Page SSR', () => {
	test('renders without errors', () => {
		expect(() =>
			render(PageComponent, {
				props: { data: { title: 'Welcome' } },
			}),
		).not.toThrow();
	});

	// SSR output is a string: assert semantic elements with their text, not wrappers or classes
	test('renders correct HTML structure', () => {
		const { body } = render(PageComponent, {
			props: {
				data: {
					title: 'Welcome',
					items: ['Alpha', 'Beta', 'Gamma'],
				},
			},
		});

		expect(body).toContain('<h1>Welcome</h1>');
		expect(body).toContain('<li>Alpha</li>');
		expect(body).toContain('<li>Beta</li>');
		expect(body).toContain('<li>Gamma</li>');
	});

	test('renders the success state', () => {
		const { body } = render(PageComponent, {
			props: { data: { status: 'success' } },
		});

		/**
		 * assert what the user gets for this status (text, accessible name);
		 * a class name or `<svg` only proves markup exists (critical-patterns: WEAK)
		 */
		expect(body).toContain('aria-label="Payment succeeded"');
		expect(body).toContain('Payment received');
	});

	test('handles empty data gracefully', () => {
		const { body } = render(PageComponent, {
			props: { data: { items: [] } },
		});

		expect(body).toContain('No items found');
	});
});

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides comprehensive instructions and best practices for testing Svelte 5 applications using Vitest and Playwright. It covers unit, SSR, and E2E testing, with a focus on resilient locators, accessibility, and the use of real web API objects like FormData and Request. No security issues were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at a024d57. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated last month
user-invocable
true

README badge

README badge for fubits1/svelte-skills/testing-svelte