accelint-react-testing

Audit React Testing Library tests for accessible queries and user interactions.

17|1|Updated Mar 14, 2025
One-click install
npx skills add https://github.com/deckgl-fiber-renderer/fiber.gl --skill accelint-react-testing-deckgl-fiber-renderer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: accelint-react-testing
Source: https://github.com/deckgl-fiber-renderer/fiber.gl/tree/main/.agents/skills/accelint-react-testing
Command: npx skills add https://github.com/deckgl-fiber-renderer/fiber.gl --skill accelint-react-testing-deckgl-fiber-renderer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill provides comprehensive guidance to fix inconsistent or brittle React Testing Library tests by codifying accessible query usage, realistic user interactions, and robust async testing practices.

Core Features & Use Cases

  • Enforces accessible query-first patterns (getByRole, getByLabelText, etc.) over brittle test IDs
  • Promotes realistic user interactions with userEvent instead of fireEvent
  • Guides async testing with findBy*, waitFor, and proper handling of async assertions
  • Encourages writing reusable custom renders with providers for complex components
  • Includes reference materials to improve test reliability, accessibility, and maintainability

Quick Start

Audit your React tests and begin applying accessible queries, realistic user interactions, and robust async patterns using RTL and Testing Library.

Frequently Asked Questions about accelint-react-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to query elements in React Testing Library to avoid brittle tests?

React Testing Library encourages using accessible queries like getByRole and getByLabelText over brittle test IDs. This approach enforces query priority, ensures correct variants, and prevents anti-patterns by testing components the way real users interact with them.

How do I test asynchronous behavior with React Testing Library and waitFor?

Async testing with React Testing Library requires using findBy* queries and waitFor to handle dynamic UI updates. This ensures reliable async assertions by properly waiting for elements to appear or disappear without relying on arbitrary timeouts.

Should I use userEvent or fireEvent for simulating interactions in RTL tests?

React Testing Library promotes userEvent over fireEvent to simulate realistic user interactions. userEvent mimics actual browser behavior more accurately, providing better event coverage and aligning tests closer to real user accessibility and interaction patterns.

How do I write custom render functions for React components with context providers?

Writing reusable custom renders with providers in React Testing Library involves wrapping the base render function with necessary context providers. This enables consistent testing of complex components requiring specific context dependencies across multiple test files.

Why does my React Testing Library test fail to find an element during async updates?

React Testing Library async test failures often stem from missing await statements or improper waitFor usage. Applying accessible queries and robust async patterns with findBy* variants resolves timing issues by explicitly waiting for DOM mutations to complete.

Does React Testing Library enforce accessibility-first assertions for React components?

React Testing Library enforces accessibility-first assertions by prioritizing accessible query variants like getByRole. This prevents anti-patterns, ensures correct query priority, and validates that components remain accessible while testing user-centric interactions effectively.