@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
md 43 lines 1.74 KB
Rendered Raw
1 # Node.js CommonJS require(esm) Interop Test
2
3 Verifies that `@composio/core` can still be loaded from a CommonJS caller on Node.js 22 through Node's native `require(esm)` support, without Composio publishing CommonJS artifacts.
4
5 ## Why This Exists
6
7 The TypeScript SDK packages are ESM-only. This suite ensures:
8
9 - `require('@composio/core')` works on Node.js 22, 24, and 25.
10 - `require.resolve('@composio/core')` resolves to `dist/index.mjs`, not a `.cjs` artifact.
11 - The main public exports remain available through Node's native CommonJS-to-ESM interop.
12
13 ## What It Tests
14
15 | Test | Description |
16 | --------------------- | ----------------------------------------------------- |
17 | require(esm) support | Node exposes native `process.features.require_module` |
18 | Entry resolution | `@composio/core` resolves to `dist/index.mjs` |
19 | CommonJS require | `require('@composio/core')` doesn't throw |
20 | Composio class | Main class is exported and constructible |
21 | OpenAIProvider | Provider class exports and instantiation |
22 | AuthScheme | Auth enum is accessible |
23 | ComposioError | Error classes are exported |
24 | jsonSchemaToZodSchema | Utility function is exported |
25 | constants | Constants namespace is accessible |
26 | logger | Logger instance is exported |
27
28 ## Fixture
29
30 ```
31 fixtures/
32 └── test.cjs # CommonJS script using require('@composio/core')
33 ```
34
35 ## Isolation Tool
36
37 **Docker** with Node.js versions: 22.23.5, 24.22.3, 26.13.1.
38
39 ## Running
40
41 ```bash
42 pnpm test:e2e
43 ```