What problem does it solve?
Writing integration tests for error processors in Mastra's core package requires simulating API errors and verifying retry behavior, which is difficult without a consistent mock model pattern and knowledge of build prerequisites.
Core Features & Use Cases
- Mock Model Pattern: Uses MockLanguageModelV2 from @internal/ai-sdk-v5/test to throw APICallError on demand and capture prompts for retry verification.
- Stream Mock Guidance: Documents the full stream event sequence (stream-start, response-metadata, text-start, text-delta, text-end, finish) required to avoid empty text output.
- Test Structure Template: Defines happy path, control, and selectivity tests for each error processor, plus message seeding with tool calls.
- Use Case: When adding a new error processor to packages/core/src/processors/, follow this guide to write tests that verify the processor catches the target error, modifies messages, and retries successfully.
Quick Start
Ask the assistant to write an integration test for a new error processor in packages/core/src/processors/ using the MockLanguageModelV2 pattern.