debug-jest

Isolate assertion, mock, and timing failures in Jest tests.

24|59|Updated Aug 28, 2015
One-click install
npx skills add https://github.com/mParticle/mparticle-web-sdk --skill debug-jest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-jest
Source: https://github.com/mParticle/mparticle-web-sdk/tree/main/.claude/skills/debug-jest
Command: npx skills add https://github.com/mParticle/mparticle-web-sdk --skill debug-jest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Debug Jest/unit test failures in mParticle Web SDK by providing a structured approach to isolate and fix assertion, mock, and timing issues that block CI and development.

Core Features & Use Cases

  • Isolation strategy: pinpoint dependencies and module boundaries causing failures.
  • Mock precision: validate mocks to match production shapes and avoid false positives.
  • Async timing handling: simulate and advance timers to resolve flaky tests.

Quick Start

Run a targeted Jest diagnostic workflow against the Web SDK test suite to identify the failing test and underlying mock or timing issues.

Frequently Asked Questions about debug-jest

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

FAQPage Schema
How do I debug failing Jest tests in a TypeScript Web SDK?

Debug failing Jest tests by systematically isolating assertion failures, validating mock definitions, and controlling async timing. This structured approach pinpoints dependencies and module boundaries causing test failures in TypeScript environments using jsdom.

Why does my Jest test fail when mocking global.fetch?

Mocking global.fetch fails when mock definitions do not match production shapes, creating false positives. Validate mocks to ensure they accurately reflect expected API responses and maintain deterministic test setups for reliable results.

How do I fix flaky Jest unit tests caused by async timing issues?

Fix flaky Jest tests by simulating and advancing timers to resolve async timing issues. Careful timing control ensures deterministic test setups, allowing you to reproduce and correct asynchronous behavior in jsdom environments.

Does this Jest debugging approach work with jsdom environments?

Yes, this Jest debugging approach works with jsdom environments. It is specifically applicable to test stories covering TypeScript modules, requiring clear mock definitions and careful timing control to reproduce and fix failures.

What is the best way to isolate assertion failures in Jest unit tests?

The best way to isolate assertion failures is applying an isolation strategy that targets dependencies and module boundaries. This method systematically identifies the root cause of failing tests within the Web SDK test suite.