This folder contains E2E tests for each provider supported by the rosetta-ai package. These tests use real provider libraries to ensure translations work correctly in practice.
cd examples
pnpm install# Run all E2E tests
pnpm testNo rebuild needed! The tests import directly from the source code (../src), so you can edit the library and immediately run tests without rebuilding.
Tests the core GenAI format with hardcoded messages. Since GenAI is the intermediate format, this validates:
- Identity translation (GenAI → GenAI)
- Auto-inference of GenAI provider
- Translation to Promptl
- Tool calls
- Reasoning parts
- String input convenience
- Round-trip translations
Uses the promptl-ai package to test real library output:
- Simple conversations compiled from PromptL syntax
- Auto-inference of Promptl provider
- Dynamic prompts with variables
- Legacy
toolArgumentsfield (backwards compatibility) - New
argsfield - Legacy tool message format (
toolName/toolIdat message level) - New
tool-resultcontent format - Reasoning and redacted-reasoning content
toolCallsarray in assistant messages- Round-trip translations with extended types
- System message extraction
Note: The OpenAI Completions provider is not yet fully implemented. Contains placeholder tests that will be enabled once the provider is complete.
Each test suite includes tests for the auto-inference feature. When you pass messages to translate() without specifying the from option, Rosetta automatically detects the provider format:
// Explicit provider specification
const result = translate(messages, { from: Provider.GenAI });
// Auto-inference (Rosetta detects the provider automatically)
const autoResult = translate(messages);The vitest.config.ts is configured to:
- Import
rosetta-aifrom source (../src/index.ts) - Support the
$packagealias for internal imports - Run all
*.test.tsfiles
This allows rapid development: edit source → run tests → see results immediately.