jest-setup-dom-matchers

Community

Fix Jest DOM matchers setup fast.

AuthorTitoPrausee
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill fixes the common Jest configuration mistake where @testing-library/jest-dom is loaded too early, causing custom matchers like toHaveAttribute, toHaveClass, and toHaveStyle to fail at runtime.

Core Features & Use Cases

  • Root Cause Diagnosis: Identifies when Jest matchers are missing because setup code ran before expect was initialized.
  • Correct Setup Separation: Recommends splitting pre-framework mocks and post-framework matcher registration into different setup files.
  • Practical Verification: Helps confirm the fix by running a test that uses jest-dom matchers after the config change.
  • Use Case: A React project has passing installs but failing tests with “is not a function” errors for DOM matchers; this Skill guides the exact configuration correction.

Quick Start

Update your Jest configuration so that pre-framework mocks stay in setupFiles and @testing-library/jest-dom is loaded from setupFilesAfterEnv.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: jest-setup-dom-matchers
Download link: https://github.com/TitoPrausee/nexus-toti/archive/main.zip#jest-setup-dom-matchers

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.