Skip to content

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

jkomyno3221fc4d8f51
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 667a09a63..ecf8122da 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -179,6 +179,12 @@ importers:
specifier: workspace:*
version: link:../../_utils
+ ts/e2e-tests/cli/whoami:
+ devDependencies:
+ '@e2e-tests/utils':
+ specifier: workspace:*
+ version: link:../../_utils
+
ts/e2e-tests/runtimes/cloudflare/cf-workers-basic:
dependencies:
'@composio/core':
@@ -656,16 +662,16 @@ importers:
version: link:../../packages/providers/llamaindex
'@llamaindex/openai':
specifier: ^0.4.20
- version: 0.4.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
+ version: 0.4.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
'@llamaindex/workflow':
specifier: ^1.1.24
- version: 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ version: 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
dotenv:
specifier: ^16.4.1
version: 16.6.1
llamaindex:
specifier: ^0.12.0
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -1262,7 +1268,7 @@ importers:
dependencies:
llamaindex:
specifier: ^0.12.0
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -7524,26 +7530,43 @@ snapshots:
tree-sitter: 0.22.4
web-tree-sitter: 0.24.7
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
transitivePeerDependencies:
- ws
- zod
optionalDependencies:
- '@modelcontextprotocol/sdk': 1.26.0(@cfworker/[email protected])([email protected])
+ '@modelcontextprotocol/sdk': 1.26.0(@cfworker/[email protected])([email protected])
hono: 4.11.9
+ zod: 3.25.76
+
+ optionalDependencies:
zod: 4.3.6
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
- '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ transitivePeerDependencies:
+ - '@modelcontextprotocol/sdk'
+ - hono
+ - next
+ - p-retry
+ - rxjs
+ - zod
+
+ dependencies:
+ '@llamaindex/core': 0.6.22
+ '@llamaindex/env': 0.1.30
+ '@llamaindex/workflow-core': 1.3.3([email protected])
transitivePeerDependencies:
- '@modelcontextprotocol/sdk'
- hono
@@ -9924,12 +9947,34 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 9.0.2
+ dependencies:
+ '@llamaindex/core': 0.6.22
+ '@llamaindex/env': 0.1.30
+ '@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
+ '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ '@types/lodash': 4.17.23
+ '@types/node': 24.10.13
+ lodash: 4.17.23
+ magic-bytes.js: 1.13.0
+ transitivePeerDependencies:
+ - '@huggingface/transformers'
+ - '@modelcontextprotocol/sdk'
+ - gpt-tokenizer
+ - hono
+ - next
+ - p-retry
+ - rxjs
+ - tree-sitter
+ - web-tree-sitter
+ - zod
+
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
'@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
- '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])
'@types/lodash': 4.17.23
'@types/node': 24.10.13
lodash: 4.17.23
@@ -10209,6 +10254,11 @@ snapshots:
is-inside-container: 1.0.0
wsl-utils: 0.1.0
+ optionalDependencies:
+ ws: 8.19.0
+ zod: 3.25.76
+
optionalDependencies:
ws: 8.19.0
diff --git a/ts/e2e-tests/cli/whoami/e2e.test.ts b/ts/e2e-tests/cli/whoami/e2e.test.ts
new file mode 100644
index 000000000..7cf8a77ae
--- /dev/null
+++ b/ts/e2e-tests/cli/whoami/e2e.test.ts
@@ -0,0 +1,69 @@
+/**
+ * CLI whoami command e2e test
+ *
+ * Verifies that the compiled composio CLI prints the API key in a scratch container.
+ */
+
+import { e2e, sanitizeOutput, type E2ETestResult, type E2ETestResultWithFiles } from '@e2e-tests/utils';
+import { TIMEOUTS } from '@e2e-tests/utils/const';
+import { describe, it, expect, beforeAll } from 'bun:test';
+
+declare module 'bun' {
+ interface Env {
+ COMPOSIO_API_KEY: string;
+ }
+}
+
+e2e(import.meta.url, {
+ versions: {
+ cli: ['current'],
+ },
+ env: {
+ COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
+ },
+ defineTests: ({ runCmd }) => {
+ const expectedApiKey = Bun.env.COMPOSIO_API_KEY.trim();
+ let whoamiResult: E2ETestResult;
+ let redirectedResult: E2ETestResultWithFiles<'out.txt'>;
+
+ beforeAll(async () => {
+ whoamiResult = await runCmd('composio whoami');
+ redirectedResult = await runCmd({
+ command: 'composio whoami > out.txt',
+ files: ['out.txt'],
+ });
+ }, TIMEOUTS.FIXTURE);
+
+ describe('composio whoami', () => {
+ it('exits successfully', () => {
+ expect(whoamiResult.exitCode).toBe(0);
+ });
+
+ it('stdout contains the API key', () => {
+ expect(sanitizeOutput(whoamiResult.stdout)).toBe(expectedApiKey);
+ });
+
+ it('stderr is empty', () => {
+ expect(whoamiResult.stderr).toBe('');
+ });
+ });
+
+ describe('stdout redirection to out.txt', () => {
+ it('exits successfully', () => {
+ expect(redirectedResult.exitCode).toBe(0);
+ });
+
+ it('stdout is empty', () => {
+ expect(redirectedResult.stdout).toBe('');
+ });
+
+ it('stderr is empty', () => {
+ expect(redirectedResult.stderr).toBe('');
+ });
+
+ it('out.txt contains the API key', () => {
+ expect(sanitizeOutput(redirectedResult.files['out.txt'])).toBe(expectedApiKey);
+ });
+ });
+ },
+});
diff --git a/ts/e2e-tests/cli/whoami/package.json b/ts/e2e-tests/cli/whoami/package.json
new file mode 100644
index 000000000..47876e696
--- /dev/null
+++ b/ts/e2e-tests/cli/whoami/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@e2e-tests/cli-whoami",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "typecheck": "tsc --noEmit",
+ "test:e2e": "bun test e2e.test.ts",
+ "test:e2e:cli": "bun test e2e.test.ts"
+ },
+ "devDependencies": {
+ "@e2e-tests/utils": "workspace:*"
+ }
+}