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, 12:15 UTC
test(cli): synchronize setup timeout clock
jkomyno committed
Sep 14, 2026 at 15:51 UTC
1d3af803a3b5ace63945065bf01340b1f29feb08
1 file changed
+11
-8
ts/packages/cli/test/src/commands/setup.cmd.test.ts
+11
-8
@@ -1,5 +1,5 @@
1
-import { describe, expect, layer } from '@effect/vitest';
2
-import { Cause, Effect, Exit, Fiber } from 'effect';
1
+import { describe, expect, it, layer } from '@effect/vitest';
2
+import { Cause, Deferred, Effect, Exit, Fiber } from 'effect';
3
import { TestClock } from 'effect/testing';
4
import { ChildProcess, ChildProcessSpawner } from 'effect/unstable/process';
5
import { afterEach, vi } from 'vitest';
@@ -1136,18 +1136,21 @@ describe('CLI: composio setup', () => {
1136
);
1137
});
1138
1139
- const hangingRunner = CommandRunner.of({
1140
- run: () => Effect.succeed(ChildProcessSpawner.ExitCode(0)),
1141
- capture: () => Effect.never,
1142
- });
1143
- layer(TestLive({ commandRunner: hangingRunner }))('hung native host', it => {
1139
+ describe('hung native host', () => {
1140
it.effect('times out instead of blocking setup forever', () =>
1141
Effect.gen(function* () {
1142
+ const captureStarted = yield* Deferred.make<void>();
1143
+ const hangingRunner = CommandRunner.of({
1144
+ run: () => Effect.succeed(ChildProcessSpawner.ExitCode(0)),
1145
+ capture: () =>
1146
+ Deferred.succeed(captureStarted, undefined).pipe(Effect.andThen(Effect.never)),
1147
+ });
1148
const fiber = yield* cli(['setup', '--target', 'claude', '--yes']).pipe(
1149
+ Effect.provide(TestLive({ commandRunner: hangingRunner })),
1150
Effect.exit,
1151
Effect.forkChild
1152
);
1150
- yield* Effect.yieldNow;
1153
+ yield* Deferred.await(captureStarted);
1154
yield* TestClock.adjust('2 minutes');
1155
const exit = yield* Fiber.join(fiber);
1156