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 22, 08:15 UTC
test(cli): add regression test for spinner double-error on callback failure
Covers the case where the callback calls `spinner.error()` then fails — the release handler must not emit a second error message.
jkomyno committed
Feb 18, 2026 at 17:41 UTC
a85835430d90b7bdaa5bf6a2d841c32430cc4e9a
1 file changed
+26
ts/packages/cli/test/src/services/terminal-ui.test.ts
+26
@@ -195,5 +195,31 @@ describe('TerminalUI', () => {
195
expect(result).toBe(99);
196
})
197
);
198
+
199
+ it.scoped(
200
+ 'useMakeSpinner does NOT double-error when callback calls spinner.error then fails',
201
+ () =>
202
+ Effect.gen(function* () {
203
+ const ui = yield* TerminalUI;
204
+
205
+ const exit = yield* Effect.exit(
206
+ ui.useMakeSpinner('fetching', spinner =>
207
+ Effect.gen(function* () {
208
+ // Simulate tapError pattern: callback calls spinner.error(), then the effect fails
209
+ yield* spinner.error('Login timed out. Please try again.');
210
+ return yield* Effect.fail(new Error('timed out'));
211
+ })
212
+ )
213
+ );
214
+
215
+ expect(exit._tag).toBe('Failure');
216
+
217
+ const lines = yield* MockConsole.getLines();
218
+ // Should see the user's error message
219
+ expect(lines).toContain('Login timed out. Please try again.');
220
+ // Should NOT see the default spinner message as a second error
221
+ expect(lines.filter(l => l === 'fetching')).toHaveLength(0);
222
+ })
223
+ );
224
});
225
});