Back to Composio

Cloudflare Workers Compatibility Tests

ts/e2e-tests/runtimes/cloudflare/cf-workers-basic/README.md

0.11.11.9 KB
Original Source

Cloudflare Workers Compatibility Tests

Verifies that @composio/core runs correctly in the Cloudflare Workers runtime environment.

Why This Exists

Cloudflare Workers use a non-Node.js runtime (workerd) with:

  • No native Node.js APIs (unless polyfilled)
  • Different module resolution
  • Restricted global scope
  • Web-standard APIs (Fetch, Request, Response)

This suite ensures @composio/core works in this constrained environment without relying on Node.js-specific features.

What It Tests

TestDescription
Import & instantiationComposio class imports and instantiates without runtime errors
Provider setupOpenAIProvider initializes correctly
Tool retrievalgetTools() returns valid tool definitions
Live API callExecute a real HackerNews action to verify end-to-end functionality
Uses LLMs?

Isolation Tool

  • wrangler: Cloudflare's CLI that runs a local workerd instance
  • @cloudflare/vitest-pool-workers: Runs Vitest tests inside the Workers runtime, not Node.js

This combination provides true runtime isolation—tests execute in the same environment as production Workers.

Setup

  1. Copy .env.example to .env and add your COMPOSIO_API_KEY
  2. Install dependencies: pnpm install

Running

bash
# Via pnpm (recommended)
pnpm test:e2e

Configuration

FilePurpose
wrangler.jsoncWorker configuration (bindings, compatibility flags)
vitest.config.mtsVitest setup with Workers pool and env bindings