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

next
md 51 lines 1.74 KB
Rendered Raw
1 # Node.js ESM Compatibility Test
2
3 Verifies that `@composio/core` works correctly when imported via `import` in ES Module environments.
4
5 ## Why This Exists
6
7 ESM is the modern JavaScript module standard. This suite ensures:
8
9 - `import('@composio/core')` resolves without errors
10 - Named imports work (`import { Composio } from '@composio/core'`)
11 - All public exports are accessible
12 - The ESM-only package entrypoints resolve correctly
13
14 ## What It Tests
15
16 | Test | Description |
17 | --------------------- | ---------------------------------------- |
18 | Dynamic import | `import('@composio/core')` doesn't throw |
19 | Composio class | Main class is exported and constructible |
20 | OpenAIProvider | Provider class exports and instantiation |
21 | AuthScheme | Auth enum is accessible |
22 | ComposioError | Error classes are exported |
23 | jsonSchemaToZodSchema | Utility function is exported |
24 | constants | Constants namespace is accessible |
25 | logger | Logger instance is exported |
26 | Named imports | Destructuring imports work correctly |
27
28 ## Fixture
29
30 ```
31 fixtures/
32 └── test.mjs # ESM test script using import()
33 ```
34
35 The fixture is a standalone `.mjs` file that:
36
37 - Uses `import('@composio/core')` to dynamically import the package
38 - Verifies each export exists and has the correct type
39 - Tests destructured named imports (`{ Composio, OpenAIProvider }`)
40 - Attempts to instantiate `OpenAIProvider` to catch runtime errors
41 - Outputs test results to stdout with pass/fail markers
42
43 ## Isolation Tool
44
45 **Docker** with Node.js versions: 22.23.5, 24.22.3, 26.13.1.
46
47 ## Running
48
49 ```bash
50 pnpm test:e2e
51 ```