testing

Create and run Vitest unit tests for HyperIndex indexers with createTestIndexer.

2|3|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/moose-code/polymarket-indexer --skill testing-moose-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/moose-code/polymarket-indexer/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/moose-code/polymarket-indexer --skill testing-moose-code

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write and run tests for HyperIndex indexers using Vitest and createTestIndexer from generated. It covers test setup, processing block ranges, asserting entity changes with toMatchInlineSnapshot, and a TDD workflow. Use this skill when writing tests, debugging handler output, or verifying indexer behavior.

Core Features & Use Cases

  • Vitest-based testing with a test harness from generated
  • Auto-exit mode to quickly validate first events and continue
  • Support for explicit block ranges, simulated events, and entity state checks

Quick Start

Install dependencies and run pnpm test to execute the Vitest-based tests

Frequently Asked Questions about testing

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

FAQPage Schema
How do I write unit tests for HyperIndex indexers using Vitest?

Unit testing HyperIndex indexers involves using Vitest alongside the createTestIndexer function from generated to process block ranges and verify handler output through snapshot assertions.

What is the best way to verify HyperIndex indexer behavior and handler output?

The best way to verify HyperIndex indexer behavior is by running Vitest with the generated test harness to simulate events, check entity states, and snapshot expected handler outputs.

How do I assert entity state changes when testing HyperIndex indexers?

You assert entity state changes in HyperIndex indexers by processing block ranges through the test harness and applying the Vitest toMatchInlineSnapshot function to lock expected entity outputs.

Do I need TypeScript to run Vitest tests for HyperIndex indexers?

Yes, TypeScript and Vitest are required to execute HyperIndex indexer tests, as the generated test harness relies on this environment to process blocks and validate entity state changes.

Can I use an auto-exit mode to validate first events when testing indexers?

Yes, you can use auto-exit mode during HyperIndex indexer testing to quickly validate the first events processed by your handlers and continue test execution for rapid feedback.

How do I simulate events and process explicit block ranges in a Vitest test harness?

You simulate events and process explicit block ranges in HyperIndex indexer tests by configuring the generated test harness, allowing you to target specific blocks and verify resulting entity state changes.