From 9e7db5ddb36ed8d0a0c3bc53c54ec6cbe658f494 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 6 Dec 2025 01:29:52 +0100 Subject: [PATCH] test(cli): ensure raw output not truncated --- tests/cli-output-utils.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/cli-output-utils.test.ts diff --git a/tests/cli-output-utils.test.ts b/tests/cli-output-utils.test.ts new file mode 100644 index 0000000..4e780fc --- /dev/null +++ b/tests/cli-output-utils.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, it, vi } from 'vitest'; +import { printCallOutput } from '../src/cli/output-utils.js'; + +describe('printCallOutput raw output', () => { + it('does not truncate long strings when printing raw output', () => { + const longText = 'x'.repeat(15000); + const log = vi.spyOn(console, 'log').mockImplementation(() => {}); + const wrapped = { + json: () => null, + markdown: () => null, + text: () => null, + }; + + try { + printCallOutput(wrapped as any, { t: longText }, 'raw'); + + expect(log).toHaveBeenCalledTimes(1); + const logged = log.mock.calls[0][0] as string; + expect(logged).not.toContain('... 5000 more characters'); + expect(logged).toContain(longText.slice(-50)); + } finally { + log.mockRestore(); + } + }); +});