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
| 1 | /** |
| 2 | * CommonJS require(esm) interop e2e test. |
| 3 | * |
| 4 | * Verifies that Node.js 22 can require @composio/core through its native |
| 5 | * require(esm) support without us publishing CommonJS artifacts. |
| 6 | */ |
| 7 | |
| 8 | import { e2e, type E2ETestResult } from '@e2e-tests/utils'; |
| 9 | import { TIMEOUTS } from '@e2e-tests/utils/const'; |
| 10 | import { describe, it, expect, beforeAll } from 'bun:test'; |
| 11 | |
| 12 | e2e(import.meta.url, { |
| 13 | versions: { |
| 14 | node: ['22.23.5', '24.22.3', '26.13.1'], |
| 15 | }, |
| 16 | usesFixtures: true, |
| 17 | defineTests: ({ runFixture }) => { |
| 18 | let result: E2ETestResult; |
| 19 | |
| 20 | beforeAll(async () => { |
| 21 | result = await runFixture({ filename: 'test.cjs' }); |
| 22 | }, TIMEOUTS.FIXTURE); |
| 23 | |
| 24 | describe('CommonJS require(esm) interop', () => { |
| 25 | it('exits successfully', () => { |
| 26 | expect(result.exitCode).toBe(0); |
| 27 | }); |
| 28 | |
| 29 | it('uses Node.js native require(esm)', () => { |
| 30 | expect(result.stdout).toContain('Test 1 passed: require(esm) is available'); |
| 31 | }); |
| 32 | |
| 33 | it('resolves the ESM entrypoint', () => { |
| 34 | expect(result.stdout).toContain('Test 2 passed: resolved ESM entrypoint'); |
| 35 | }); |
| 36 | |
| 37 | it('require() succeeds', () => { |
| 38 | expect(result.stdout).toContain('Test 3 passed: require() succeeded'); |
| 39 | }); |
| 40 | |
| 41 | it('exports Composio class', () => { |
| 42 | expect(result.stdout).toContain('Test 4 passed: Composio class is exported'); |
| 43 | }); |
| 44 | |
| 45 | it('exports OpenAIProvider class', () => { |
| 46 | expect(result.stdout).toContain('Test 5 passed: OpenAIProvider class is exported'); |
| 47 | }); |
| 48 | |
| 49 | it('instantiates OpenAIProvider successfully', () => { |
| 50 | expect(result.stdout).toContain('Test 6 passed: OpenAIProvider instantiated successfully'); |
| 51 | }); |
| 52 | |
| 53 | it('exports AuthScheme', () => { |
| 54 | expect(result.stdout).toContain('Test 7 passed: AuthScheme is exported'); |
| 55 | }); |
| 56 | |
| 57 | it('exports Error classes', () => { |
| 58 | expect(result.stdout).toContain('Test 8 passed: Error classes are exported'); |
| 59 | }); |
| 60 | |
| 61 | it('exports jsonSchemaToZodSchema', () => { |
| 62 | expect(result.stdout).toContain('Test 9 passed: jsonSchemaToZodSchema is exported'); |
| 63 | }); |
| 64 | |
| 65 | it('exports constants namespace', () => { |
| 66 | expect(result.stdout).toContain('Test 10 passed: constants namespace is exported'); |
| 67 | }); |
| 68 | |
| 69 | it('exports logger', () => { |
| 70 | expect(result.stdout).toContain('Test 11 passed: logger is exported'); |
| 71 | }); |
| 72 | |
| 73 | it('completes all tests', () => { |
| 74 | expect(result.stdout).toContain('All CommonJS require(esm) interop tests passed!'); |
| 75 | }); |
| 76 | }); |
| 77 | }, |
| 78 | }); |