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 | import { describe, expect, it } from '@effect/vitest'; |
| 2 | import { Effect } from 'effect'; |
| 3 | import { DetachedProcessSpawnError, spawnDetached } from 'src/services/detached-process'; |
| 4 | |
| 5 | describe('spawnDetached', () => { |
| 6 | it.effect('fails when the executable does not exist', () => |
| 7 | Effect.gen(function* () { |
| 8 | const command = '__composio_missing_detached_process__'; |
| 9 | const error = yield* spawnDetached(command, []).pipe(Effect.flip); |
| 10 | |
| 11 | expect(error).toBeInstanceOf(DetachedProcessSpawnError); |
| 12 | expect(error.command).toBe(command); |
| 13 | expect(String(error.cause)).toContain('ENOENT'); |
| 14 | }) |
| 15 | ); |
| 16 | |
| 17 | it.effect('succeeds after the child process spawns', () => |
| 18 | Effect.gen(function* () { |
| 19 | yield* spawnDetached(process.execPath, ['-e', 'process.exit(0)']); |
| 20 | }) |
| 21 | ); |
| 22 | }); |