Rust Testing
The Rust implementation uses standardcargo test along with specialized tools.
Running Tests
Run Full Test Suite (If Needed)
If you changed
common, core, or protocol crates, run the complete test suite:Snapshot Tests
Codex uses snapshot tests viainsta to validate rendered output, especially in codex-tui.
Requirement: Any change that affects user-visible UI must include corresponding
insta snapshot coverage.Installing cargo-insta
Installing cargo-insta
If you don’t have the tool installed:
Test Assertions Best Practices
Integration Tests
When writing end-to-end Codex tests, use the utilities incore_test_support::responses.
Spawning Workspace Binaries in Tests
TypeScript Testing
The TypeScript CLI uses Vitest for unit tests.Running TypeScript Tests
Git Hooks
The TypeScript project uses Husky to enforce code quality:- Pre-commit hook: Runs lint-staged to format and lint files
- Pre-push hook: Runs tests and type checking
These hooks help maintain code quality and prevent pushing code with failing tests.
App-Server Protocol Testing
After changing API shapes inapp-server-protocol:
Sandbox Testing
Test commands under the Codex sandbox using dedicated subcommands:Before Submitting a PR
Before marking your PR as ready for review, run all checks locally:- Rust
- TypeScript
Next Steps
Guidelines
Review contribution guidelines
Building
Learn how to build the project