React query test harness fixer
Fix React/Vitest test failures for TanStack React Query components and jsdom side effects. Use when React Query component tests fail under Vitest or jsdom with hangs, act warnings, or side-effect leaks.From its SKILL.md
npx -y skills add VJDiPaola/skill-forge --skill react-query-test-harness-fixerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 17 days oldThe repository was created 17 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.8 KB, 361 tokens by cl100k_base, as published. Nobody here has run it
React Query Test Harness Fixer
Use this workflow when test setup has fallen behind the app's React Query and browser dependencies.
Read First
- The failing test file
- The page or component under test
- Shared test setup such as
client/tests/setup.ts - Any route or data modules the component depends on
Workflow
- Identify every
useQuery,useMutation, and route dependency used by the rendered component. - Wrap the render path in a fresh
QueryClientProvider. - Create a new
QueryClientper helper or per test and setretry: falsefor deterministic failures. - Stub network calls at the boundary the component actually uses. Return stable list and detail responses.
- Recreate routing context with the same router the app uses, such as
memoryLocationforwouter. - Wait for async UI with
findBy...orwaitForafter the query resolves. - Neutralize browser-only side effects.
Browser API Rules
- Mock
navigator.clipboardin the test when copy behavior is asserted. - Put durable browser shims in shared test setup for
matchMediaandHTMLCanvasElement.getContext. - Mock side-effect libraries such as
canvas-confettidirectly when the animation is not part of the assertion. - Clear
localStorageand reset globals after each test.
Anti-Patterns
- Do not share one
QueryClientacross unrelated tests. - Do not assert on post-query UI before the fetch promise has resolved.
- Do not leave broad fetch mocks or global state behind between tests.
Validation
- Run the targeted test file first.
- Run
npm.cmd run test. - Run
npm.cmd run check.
What ships with it: 2 files
477 B alongside SKILL.md
agents/
- openai.yaml281 B
- catalog.yaml196 B