Back to list
patrickhaahr

frontend-testing-patterns

by patrickhaahr

i use arch and neovim btw

0🍴 0📅 Jan 19, 2026

SKILL.md


name: frontend-testing-patterns description: Expert guide for frontend testing best practices following the Testing Trophy (Static, Unit, Integration, E2E). Provides framework-specific patterns for component, hook, and integration testing. Currently supports SolidJS with Vitest. Use this skill when writing, reviewing, or setting up frontend tests.

Frontend Testing Patterns

Comprehensive testing guide for frontend applications following the Testing Trophy methodology. Prioritizes confidence over coverage with a focus on integration tests while maintaining appropriate test distribution.

When to Apply

Reference these guidelines when:

  • Writing tests for frontend components, hooks, or utilities
  • Setting up a new testing environment
  • Reviewing test code for best practices
  • Choosing the right type of test for a feature
  • Debugging flaky or slow tests

Testing Trophy Distribution

LevelCountFocusTools
StaticContinuousType errors, lintingTypeScript, ESLint
UnitManyPure functions, utilitiesVitest
IntegrationSomeComponent interactions, hooksVitest + Testing Library
E2EFewCritical user flowsPlaywright

Framework-Specific Guides

This skill uses a modular structure. Consult the appropriate framework guide:

FrameworkFileTest Runner
SolidJSframeworks/solidjs-tests.mdVitest

Template: See frameworks/framework.md for adding new frameworks.

Quick Reference

1. Static Analysis (Continuous)

TypeScript catches bugs before tests run. Configure strict mode:

{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitReturns": true
  }
}

2. Unit Tests (Many)

Test pure functions and utilities in isolation:

import { describe, it, expect } from 'vitest'
import { formatCurrency, validateEmail } from './utils'

describe('formatCurrency', () => {
  it('formats positive numbers correctly', () => {
    expect(formatCurrency(1234.56)).toBe('$1,234.56')
  })

  it('handles zero', () => {
    expect(formatCurrency(0)).toBe('$0.00')
  })
})

3. Integration Tests (Some)

Test component behavior from a user's perspective:

// See framework-specific guide for syntax
// Focus on: user interactions, state changes, async behavior

4. E2E Tests (Few)

Test critical user journeys across multiple pages:

import { test, expect } from '@playwright/test'

test('user can complete checkout', async ({ page }) => {
  await page.goto('/products')
  await page.click('[data-testid="add-to-cart"]')
  await page.click('[data-testid="checkout"]')
  await expect(page.locator('[data-testid="order-confirmation"]')).toBeVisible()
})

How to Use

  1. Read the base patterns in this file
  2. Consult the framework-specific guide in frameworks/
  3. Full expanded guide: AGENTS.md

Each framework guide contains:

  • Project setup and configuration
  • Component testing patterns
  • Async and reactive testing
  • Mocking strategies
  • Common pitfalls

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon