Where Are the Unit Tests Located in the Openwork Repository?

OpenWork stores unit tests in package-specific test/ directories under dev/packages/, using *.test.ts or *.test.mjs file patterns, with test discovery configured in dev/evals/vitest.config.ts.

The different-ai/openwork monorepo organizes its testing infrastructure alongside each package to maintain modularity. Understanding exactly where the unit tests are located in the Openwork repository allows developers to run targeted test suites and contribute effectively. This guide maps the concrete file paths, naming conventions, and execution commands found in the source code.

Unit Test Directory Structure

OpenWork follows a co-located test pattern. Rather than storing all tests in a top-level folder, each package maintains its own test/ directory containing files that validate its specific functionality.

Core Package Test Locations

Unit tests reside in dev/packages/<package-name>/test/:

The handsfree package includes end-to-end specifications at dev/packages/handsfree/test/e2e/run.mjs, demonstrating that integration tests also live within their respective package scopes.

Test Configuration and Discovery

Test discovery is centralized in dev/evals/vitest.config.ts. This configuration file determines which files Vitest recognizes as test suites:

// dev/evals/vitest.config.ts
export default defineConfig({
  test: {
    // Unit tests: any *.test.ts under any package
    include: ["specs/**/*.test.ts"],
    // Slow, app-driving specs are excluded from the default run
    exclude: ["**/*.slow.test.ts"],
  },
});

The include and exclude patterns ensure that standard unit tests run separately from slower end-to-end specifications located in dev/evals/specs/**/*.slow.test.ts.

Test File Naming Conventions

OpenWork uses distinct file extensions to differentiate test environments:

  • Standard unit tests: *.test.ts for TypeScript packages
  • Module-based tests: *.test.mjs for ES Module packages like openwork-bootstrap
  • Slow/E2E tests: *.slow.test.ts for full-stack specifications in dev/evals/specs/

Running the Unit Tests

Execute package-specific tests using pnpm with the package filter:


# Run bootstrap unit tests

pnpm --filter openwork-bootstrap exec node test/openwork-bootstrap.test.mjs

# Run enterprise MCP client tests

pnpm --filter @openwork/enterprise-mcp-client exec bun test

# Run tests with tsx for TypeScript files

pnpm --filter enterprise-mcp-client exec tsx --test test/*.test.ts

To run the complete evaluation suite:

pnpm install
pnpm --filter @openwork/desktop exec bun test

For slow end-to-end specifications that drive the full Electron/Deno stack:

pnpm --filter openwork-ee exec bun test dev/evals/specs/**/*.slow.test.ts

Summary

  • Unit tests are co-located in dev/packages/<package>/test/ directories
  • File patterns follow *.test.ts or *.test.mjs conventions
  • Test discovery is controlled by dev/evals/vitest.config.ts
  • Slow E2E tests are separated in dev/evals/specs/ with *.slow.test.ts pattern
  • Execution uses pnpm filters targeting specific packages or the bun test runner

Frequently Asked Questions

How do I run tests for only one package?

Use the pnpm --filter command followed by the package name and test execution command. For example, pnpm --filter enterprise-mcp-client exec bun test runs only the tests located in dev/packages/enterprise-mcp-client/test/.

What is the difference between .test.ts and .slow.test.ts files?

Standard *.test.ts files contain fast unit tests that run by default, while *.slow.test.ts files in dev/evals/specs/ contain integration tests that drive the full application stack. The vitest.config.ts explicitly excludes slow tests from default runs to keep feedback loops quick.

Where are the end-to-end tests located?

End-to-end tests reside in two locations: package-specific E2E tests like dev/packages/handsfree/test/e2e/run.mjs, and repository-wide slow specifications in dev/evals/specs/**/*.slow.test.ts which test complete user workflows.

Do I need Vitest installed globally to run these tests?

No. The repository uses Vitest configured in dev/evals/vitest.config.ts and executes tests through pnpm scripts or bun. As long as you run pnpm install from the repository root, the test runners resolve locally without global installation.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →