# Testing Core Processors

Use when writing or debugging integration tests for error processors in...

- Repository: https://github.com/mastra-ai/mastra (29259 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add mastra-ai/mastra --skill testing-core-processors -g -a claude-code -y`
Codex: `npx skills add mastra-ai/mastra --skill testing-core-processors -g -a codex -y`
Cursor: `npx skills add mastra-ai/mastra --skill testing-core-processors -g -a cursor -y`
Gemini CLI: `npx skills add mastra-ai/mastra --skill testing-core-processors -g -a gemini-cli -y`

## Description

Use when writing or debugging integration tests for error processors in packages/core/src/processors/. Covers the MockLanguageModelV2 pattern for simulating API errors and verifying retry behavior, plus the build prerequisites for focused vitest runs.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Testing Core Error Processors

How to write integration tests for error processors in `packages/core/src/processors/`.

## Prerequisites

- Build core before running tests: `pnpm build:core` (from repo root)
- If focused vitest runs fail to resolve `@internal/test-utils/setup`, the build step was skipped

## Mock Model Pattern

Use `MockLanguageModelV2` from `@internal/ai-sdk-v5/test` to simulate API errors and verify retry behavior.

```ts
import { APICallError } from '@internal/ai-sdk-v5';
import { convertArrayToReadableStream, MockLanguageModelV2 } from '@internal/ai-sdk-v5/test';

// Track calls and captured prompts
let callCount = 0;
const receivedPrompts: any[] = [];

The rest: https://github.com/mastra-ai/mastra/blob/HEAD/.agents/skills/testing-core-processors/SKILL.md
