manutej/luxor-claude-marketplace/jest-react-testing
Claude Code and agent skill by manutej/luxor-claude-marketplace
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Comprehensive React component testing with Jest and React Testing Library covering configuration, mocking strategies, async testing patterns, hooks testing, and integration testing best practices
Install
npx vskill@latest install manutej/luxor-claude-marketplace/jest-react-testingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Jest React Testing
A comprehensive skill for testing React applications using Jest and React Testing Library. This skill covers everything from basic component testing to advanced patterns including mocking, async testing, custom hooks testing, and integration testing strategies.
When to Use This Skill
Use this skill when:
- Testing React components with Jest and React Testing Library
- Setting up Jest configuration for React projects
- Writing unit tests for components, hooks, and utilities
- Testing user interactions and component behavior
- Mocking modules, functions, API calls, and external dependencies
- Testing asynchronous operations (API calls, timers, promises)
- Testing custom React hooks
- Writing integration tests for complex component trees
- Debugging failing tests or improving test coverage
- Following testing best practices and patterns
Core Concepts
Testing Philosophy
React Testing Library follows these guiding principles:
- Test User Behavior, Not Implementation: Write tests that resemble how users interact with your app
- Accessibility First: Use queries that promote accessible components (getByRole, getByLabelText)
- Avoid Testing Implementation Details: Don't test state, props, or internal methods directly
- Maintainable Tests: Tests should break when behavior changes, not when code refactors
- Confidence Over Coverage: Focus on tests that give confidence, not 100% coverage
Key Testing Concepts
- Queries: Methods to find elements (getBy, queryBy, findBy)
- User Events: Simulating user interactions (click, type, select)
- Async Testing: Testing components with asynchronous operations
- Mocking: Replacing dependencies with controlled test doubles
- Assertions: Verifying expected outcomes with matchers
Jest Configuration
Basic Jest Configuration
jest.config.js (JavaScript projects):
jest.config.js (TypeScript projects):
Setup Files
src/setupTests.js:
File Mocks
__mocks__/fileMock.js:
__mocks__/styleMock.js:
React Testing Library Queries
Query Types
React Testing Library provides three types of queries:
- getBy: Returns element or throws error (use for elements that should exist)
- queryBy: Returns element or null (use for elements that may not exist)
- findBy: Returns promise that resolves to element (use for async elements)
Query Priority
Recommended Query Order (accessibility-focused):
- getByRole: Most accessible query
``javascript getByRole('button', { name: /submit/i }) getByRole('heading', { level: 1 }) getByRole('textbox', { name: /username/i }) ``
- getByLabelText: For form fields with labels
``javascript getByLabelText(/email address/i) getByLabelText('Password') ``
- getByPlaceholderText: For inputs with placeholders
``javascript getByPlaceholderText(/search/i) ``
- getByText: For non-interactive elements with text
``javascript getByText(/welcome/i) getByText('Error: Invalid credentials') ``
- getByDisplayValue: For form elements with values
``javascript getByDisplayValue('John Doe') ``
- getByAltText: For images with alt text
``javascript getByAltText(/profile picture/i) ``
- getByTitle: For elements with title attribute
``javascript getByTitle(/close/i) ``
- getByTestId: Last resort when other queries don't work
``javascript getByTestId('custom-element') ``
Query Variants
Component Testing Strategies
Basic Component Test
Testing User Interactions
Testing Forms
Testing Conditional Rendering
Mocking Patterns
Mocking Modules
Automatic Mock:
Usage in test:
Mocking Functions
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/luxor-frontend-essentials/skills/jest-react-testing/SKILL.md
Popularity
- Repository stars
- 44
- Repository forks
- 9
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 8 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/manutej/luxor-claude-marketplace/jest-react-testing)