Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | /** |
| 2 | * ESM compatibility e2e test |
| 3 | * |
| 4 | * Verifies that @composio/core can be imported using ESM import syntax in Node.js. |
| 5 | */ |
| 6 | |
| 7 | import { e2e, type E2ETestResult } from '@e2e-tests/utils'; |
| 8 | import { TIMEOUTS } from '@e2e-tests/utils/const'; |
| 9 | import { describe, it, expect, beforeAll } from 'bun:test'; |
| 10 | |
| 11 | e2e(import.meta.url, { |
| 12 | versions: { |
| 13 | node: ['22.23.5', '24.22.3', '26.13.1'], |
| 14 | }, |
| 15 | usesFixtures: true, |
| 16 | defineTests: ({ runFixture }) => { |
| 17 | let result: E2ETestResult; |
| 18 | |
| 19 | beforeAll(async () => { |
| 20 | result = await runFixture({ filename: 'test.mjs' }); |
| 21 | }, TIMEOUTS.FIXTURE); |
| 22 | |
| 23 | describe('ESM compatibility', () => { |
| 24 | it('exits successfully', () => { |
| 25 | expect(result.exitCode).toBe(0); |
| 26 | }); |
| 27 | |
| 28 | it('import() succeeds', () => { |
| 29 | expect(result.stdout).toContain('Test 1 passed: import() succeeded'); |
| 30 | }); |
| 31 | |
| 32 | it('exports Composio class', () => { |
| 33 | expect(result.stdout).toContain('Test 2 passed: Composio class is exported'); |
| 34 | }); |
| 35 | |
| 36 | it('exports OpenAIProvider class', () => { |
| 37 | expect(result.stdout).toContain('Test 3 passed: OpenAIProvider class is exported'); |
| 38 | }); |
| 39 | |
| 40 | it('instantiates OpenAIProvider successfully', () => { |
| 41 | expect(result.stdout).toContain('Test 4 passed: OpenAIProvider instantiated successfully'); |
| 42 | }); |
| 43 | |
| 44 | it('exports AuthScheme', () => { |
| 45 | expect(result.stdout).toContain('Test 5 passed: AuthScheme is exported'); |
| 46 | }); |
| 47 | |
| 48 | it('exports Error classes', () => { |
| 49 | expect(result.stdout).toContain('Test 6 passed: Error classes are exported'); |
| 50 | }); |
| 51 | |
| 52 | it('exports jsonSchemaToZodSchema', () => { |
| 53 | expect(result.stdout).toContain('Test 7 passed: jsonSchemaToZodSchema is exported'); |
| 54 | }); |
| 55 | |
| 56 | it('exports constants namespace', () => { |
| 57 | expect(result.stdout).toContain('Test 8 passed: constants namespace is exported'); |
| 58 | }); |
| 59 | |
| 60 | it('exports logger', () => { |
| 61 | expect(result.stdout).toContain('Test 9 passed: logger is exported'); |
| 62 | }); |
| 63 | |
| 64 | it('supports static import syntax', () => { |
| 65 | expect(result.stdout).toContain('Test 10 passed: Static import syntax works'); |
| 66 | }); |
| 67 | |
| 68 | it('completes all tests', () => { |
| 69 | expect(result.stdout).toContain('All ESM compatibility tests passed!'); |
| 70 | }); |
| 71 | }); |
| 72 | }, |
| 73 | }); |