@devries-cameron20 / composio-1 / commits / 3221fc4d8
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.

feat(ts/e2e): add `composio whoami` e2e test

Verifies that `composio whoami` outputs the API key to stdout when piped, with empty stderr and correct exit code.

jkomyno committed Feb 18, 2026 at 15:39 UTC 3221fc4d8f5141df268799bd04a73c29f468f403
3 files changed +145 -12
pnpm-lock.yaml
+62 -12
@@ -179,6 +179,12 @@ importers:
179 specifier: workspace:*
180 version: link:../../_utils
181
182 + ts/e2e-tests/cli/whoami:
183 + devDependencies:
184 + '@e2e-tests/utils':
185 + specifier: workspace:*
186 + version: link:../../_utils
187 +
188 ts/e2e-tests/runtimes/cloudflare/cf-workers-basic:
189 dependencies:
190 '@composio/core':
@@ -656,16 +662,16 @@ importers:
662 version: link:../../packages/providers/llamaindex
663 '@llamaindex/openai':
664 specifier: ^0.4.20
659 - version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@4.3.6)
665 + version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@3.25.76)
666 '@llamaindex/workflow':
667 specifier: ^1.1.24
662 - version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
668 + version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
669 dotenv:
670 specifier: ^16.4.1
671 version: 16.6.1
672 llamaindex:
673 specifier: ^0.12.0
668 - version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
674 + version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76)
675 devDependencies:
676 '@types/bun':
677 specifier: ^1.2.9
@@ -1262,7 +1268,7 @@ importers:
1268 dependencies:
1269 llamaindex:
1270 specifier: ^0.12.0
1265 - version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1271 + version: 0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1272 devDependencies:
1273 '@composio/core':
1274 specifier: workspace:*
@@ -7524,26 +7530,43 @@ snapshots:
7530 tree-sitter: 0.22.4
7531 web-tree-sitter: 0.24.7
7532
7527 - '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@4.3.6)':
7533 + '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@3.25.76)':
7534 dependencies:
7535 '@llamaindex/core': 0.6.22
7536 '@llamaindex/env': 0.1.30
7531 - openai: 5.23.2(ws@8.19.0)(zod@4.3.6)
7537 + openai: 5.23.2(ws@8.19.0)(zod@3.25.76)
7538 transitivePeerDependencies:
7539 - ws
7540 - zod
7541
7536 - '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
7542 + '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
7543 optionalDependencies:
7538 - '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6)
7544 + '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76)
7545 hono: 4.11.9
7546 + zod: 3.25.76
7547 +
7548 + '@llamaindex/workflow-core@1.3.3(zod@4.3.6)':
7549 + optionalDependencies:
7550 zod: 4.3.6
7551
7542 - '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
7552 + '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
7553 dependencies:
7554 '@llamaindex/core': 0.6.22
7555 '@llamaindex/env': 0.1.30
7546 - '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
7556 + '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
7557 + transitivePeerDependencies:
7558 + - '@modelcontextprotocol/sdk'
7559 + - hono
7560 + - next
7561 + - p-retry
7562 + - rxjs
7563 + - zod
7564 +
7565 + '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)':
7566 + dependencies:
7567 + '@llamaindex/core': 0.6.22
7568 + '@llamaindex/env': 0.1.30
7569 + '@llamaindex/workflow-core': 1.3.3(zod@4.3.6)
7570 transitivePeerDependencies:
7571 - '@modelcontextprotocol/sdk'
7572 - hono
@@ -9924,12 +9947,34 @@ snapshots:
9947 rfdc: 1.4.1
9948 wrap-ansi: 9.0.2
9949
9927 - llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
9950 + llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76):
9951 + dependencies:
9952 + '@llamaindex/core': 0.6.22
9953 + '@llamaindex/env': 0.1.30
9954 + '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
9955 + '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
9956 + '@types/lodash': 4.17.23
9957 + '@types/node': 24.10.13
9958 + lodash: 4.17.23
9959 + magic-bytes.js: 1.13.0
9960 + transitivePeerDependencies:
9961 + - '@huggingface/transformers'
9962 + - '@modelcontextprotocol/sdk'
9963 + - gpt-tokenizer
9964 + - hono
9965 + - next
9966 + - p-retry
9967 + - rxjs
9968 + - tree-sitter
9969 + - web-tree-sitter
9970 + - zod
9971 +
9972 + llamaindex@0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
9973 dependencies:
9974 '@llamaindex/core': 0.6.22
9975 '@llamaindex/env': 0.1.30
9976 '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
9932 - '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
9977 + '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)
9978 '@types/lodash': 4.17.23
9979 '@types/node': 24.10.13
9980 lodash: 4.17.23
@@ -10209,6 +10254,11 @@ snapshots:
10254 is-inside-container: 1.0.0
10255 wsl-utils: 0.1.0
10256
10257 + openai@5.23.2(ws@8.19.0)(zod@3.25.76):
10258 + optionalDependencies:
10259 + ws: 8.19.0
10260 + zod: 3.25.76
10261 +
10262 openai@5.23.2(ws@8.19.0)(zod@4.3.6):
10263 optionalDependencies:
10264 ws: 8.19.0
ts/e2e-tests/cli/whoami/e2e.test.ts new
+69
@@ -0,0 +1,69 @@
1 +/**
2 + * CLI whoami command e2e test
3 + *
4 + * Verifies that the compiled composio CLI prints the API key in a scratch container.
5 + */
6 +
7 +import { e2e, sanitizeOutput, type E2ETestResult, type E2ETestResultWithFiles } from '@e2e-tests/utils';
8 +import { TIMEOUTS } from '@e2e-tests/utils/const';
9 +import { describe, it, expect, beforeAll } from 'bun:test';
10 +
11 +declare module 'bun' {
12 + interface Env {
13 + COMPOSIO_API_KEY: string;
14 + }
15 +}
16 +
17 +e2e(import.meta.url, {
18 + versions: {
19 + cli: ['current'],
20 + },
21 + env: {
22 + COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
23 + },
24 + defineTests: ({ runCmd }) => {
25 + const expectedApiKey = Bun.env.COMPOSIO_API_KEY.trim();
26 + let whoamiResult: E2ETestResult;
27 + let redirectedResult: E2ETestResultWithFiles<'out.txt'>;
28 +
29 + beforeAll(async () => {
30 + whoamiResult = await runCmd('composio whoami');
31 + redirectedResult = await runCmd({
32 + command: 'composio whoami > out.txt',
33 + files: ['out.txt'],
34 + });
35 + }, TIMEOUTS.FIXTURE);
36 +
37 + describe('composio whoami', () => {
38 + it('exits successfully', () => {
39 + expect(whoamiResult.exitCode).toBe(0);
40 + });
41 +
42 + it('stdout contains the API key', () => {
43 + expect(sanitizeOutput(whoamiResult.stdout)).toBe(expectedApiKey);
44 + });
45 +
46 + it('stderr is empty', () => {
47 + expect(whoamiResult.stderr).toBe('');
48 + });
49 + });
50 +
51 + describe('stdout redirection to out.txt', () => {
52 + it('exits successfully', () => {
53 + expect(redirectedResult.exitCode).toBe(0);
54 + });
55 +
56 + it('stdout is empty', () => {
57 + expect(redirectedResult.stdout).toBe('');
58 + });
59 +
60 + it('stderr is empty', () => {
61 + expect(redirectedResult.stderr).toBe('');
62 + });
63 +
64 + it('out.txt contains the API key', () => {
65 + expect(sanitizeOutput(redirectedResult.files['out.txt'])).toBe(expectedApiKey);
66 + });
67 + });
68 + },
69 +});
ts/e2e-tests/cli/whoami/package.json new
+14
@@ -0,0 +1,14 @@
1 +{
2 + "name": "@e2e-tests/cli-whoami",
3 + "version": "0.0.0",
4 + "private": true,
5 + "type": "module",
6 + "scripts": {
7 + "typecheck": "tsc --noEmit",
8 + "test:e2e": "bun test e2e.test.ts",
9 + "test:e2e:cli": "bun test e2e.test.ts"
10 + },
11 + "devDependencies": {
12 + "@e2e-tests/utils": "workspace:*"
13 + }
14 +}