Skills

Testing Core Processors

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

Install

npx skills add mastra-ai/mastra --skill testing-core-processors -g -a claude-code -y
Repository
mastra-ai/mastra29.3k
Category
Testing
Updated
3d ago
License
See repository
Context cost
Lightabout 982 tokens
Runs scripts
No, instructions only

What it does

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.

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.

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[] = [];
Read the whole SKILL.md on GitHub

More in Testing