How to Run Tests for the Corsair Project: A Complete Guide
Use pnpm test in the repository root to run the full test suite, or pnpm --filter @corsair-dev/<plugin> test to target a specific plugin.
The Corsair monorepo is a collection of more than 150 plugins for integrating external APIs into LLM applications. Learning how to run tests for the Corsair project efficiently requires understanding its PNPM workspace and Turbo orchestration setup. This guide covers commands for running the full suite, individual plugins, and understanding the live versus offline test behavior.
Run the Full Test Suite
The simplest way to run tests for the Corsair project is from the repository root:
pnpm test
This command executes the test script defined in package.json at the project root. According to the source code, this script runs turbo --filter "./packages/*" test【/cache/repos/github.com/corsairdev/corsair/main/package.json†L13-L14】. Turbo then discovers every package under packages/ and invokes that package's own test script in parallel where possible.
This approach ensures comprehensive coverage across all plugins while leveraging Turbo's caching to skip unchanged packages.
Run Tests for a Single Plugin
For focused development, target individual plugins using PNPM's --filter flag with the package name from each plugin's package.json:
# OpenAI plugin tests
pnpm --filter @corsair-dev/openai test
# Webflow plugin tests
pnpm --filter @corsair-dev/webflow test
# Pinecone plugin tests
pnpm --filter @corsair-dev/pinecone test
Each plugin defines its own test command. Most use Jest as the test runner. For example, the OpenAI plugin's package.json specifies "name": "@corsair-dev/openai" with a test script of "test": "jest"【/cache/repos/github.com/corsairdev/corsair/main/packages/openai/README.md†L1-L4】.
Filter commands are essential when iterating on a single plugin, avoiding the overhead of running 150+ test suites.
Run Explorer Component Tests
The Explorer is a standalone HTTP catalog component with its own package structure:
cd explorer
pnpm test
The Explorer's package.json lives at explorer/package.json【/cache/repos/github.com/corsairdev/corsair/main/explorer/package.json†L1-L9】. Note that test scripts may need to be added for future Explorer-specific validation; currently the directory focuses on build and start operations.
To build and run the Explorer locally:
cd explorer
pnpm build
pnpm start
Understand Live vs. Offline Tests
Corsair plugins implement a two-tier testing strategy to protect CI pipelines and local development.
Offline Schema Tests
- Run by default with no configuration
- Validate JSON schemas, TypeScript types, and mock data
- Always execute in
pnpm testruns
Live API Tests
- Require environment variables with actual API credentials
- Automatically skipped when credentials are absent
- Example:
OPENAI_API_KEYenables live OpenAI plugin tests
The OpenAI README documents this behavior explicitly: tests check for the presence of required environment variables and skip live validation when missing【/cache/repos/github.com/corsairdev/corsair/main/packages/openai/README.md†L104-L112】.
Run Tests in CI Pipelines
Continuous integration uses the same root command:
pnpm test
This standardized approach ensures CI and local environments behave identically. The credential-safe default (offline tests only) prevents flaky failures from external service outages or rate limits.
Complete Command Reference
| Scenario | Command |
|---|---|
| Full monorepo suite | pnpm test |
| Single plugin (OpenAI) | pnpm --filter @corsair-dev/openai test |
| Single plugin (Webflow) | pnpm --filter @corsair-dev/webflow test |
| With live tests enabled | OPENAI_API_KEY=xxx pnpm --filter @corsair-dev/openai test |
| Explorer build + start | cd explorer && pnpm build && pnpm start |
How the Test Architecture Works
Three design decisions enable efficient test execution in the Corsair project:
-
Monorepo structure — All plugins reside under
packages/. Turbo filters by glob patterns to isolate test execution without cross-package interference. -
Unified tooling — PNPM workspaces provide consistent command interfaces. Whether running one plugin or 150, the same
pnpmcommands apply. -
Credential isolation — Environment-gated live tests keep secrets out of repository code and prevent CI failures from external API instability.
Summary
- Run
pnpm testfrom the repository root to execute all plugin tests via Turbo - Use
pnpm --filter @corsair-dev/<name> testfor single-plugin testing - Offline tests run by default; live tests require specific environment variables
- The Explorer component operates as a separate package in the
explorer/directory - CI pipelines use identical commands to local development for reproducibility
Frequently Asked Questions
What test runner does Corsair use for plugins?
Most plugins use Jest as the test runner. Individual plugin package.json files define "test": "jest" or variant commands. The specific configuration varies by plugin needs, but Jest provides the underlying framework across the monorepo.
Why do some tests skip automatically when I run pnpm test?
Live tests that call actual external APIs skip when required credentials are absent. This is intentional design—offline schema tests always run, while live validation only executes when you've explicitly provided API keys via environment variables. Check plugin README files for the specific variables each integration requires.
Can I run tests in parallel or with caching?
Turbo handles parallelization and caching automatically when you run pnpm test. Turbo's task pipeline executes independent test suites concurrently and caches results for packages without code changes. For single-plugin runs, standard Jest parallelism applies based on that plugin's configuration.
How do I add tests for a new plugin I'm building?
Create a test script in your plugin's package.json pointing to your test runner. Follow the naming convention @corsair-dev/<your-plugin> so the --filter flag works correctly. Include offline tests for schemas and types, and gate any live API tests behind environment variable checks to maintain CI safety.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →