From 3ed93d5b5d2f3bfdcfab2b6f96449503e2a41c41 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Wed, 19 Nov 2025 10:23:16 +0800 Subject: [PATCH] fix: integration tests (#1062) --- docs/features/subagents.md | 10 ++--- .../context-compress-interactive.test.ts | 42 +++++++++---------- .../file-system-interactive.test.ts | 20 ++++----- .../messages/CompressionMessage.tsx | 2 +- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/docs/features/subagents.md b/docs/features/subagents.md index 225384ca..506d856f 100644 --- a/docs/features/subagents.md +++ b/docs/features/subagents.md @@ -106,7 +106,7 @@ Subagents are configured using Markdown files with YAML frontmatter. This format --- name: agent-name description: Brief description of when and how to use this agent -tools: +tools: - tool1 - tool2 - tool3 # Optional @@ -170,7 +170,7 @@ Perfect for comprehensive test creation and test-driven development. --- name: testing-expert description: Writes comprehensive unit tests, integration tests, and handles test automation with best practices -tools: +tools: - read_file - write_file - read_many_files @@ -214,7 +214,7 @@ Specialized in creating clear, comprehensive documentation. --- name: documentation-writer description: Creates comprehensive documentation, README files, API docs, and user guides -tools: +tools: - read_file - write_file - read_many_files @@ -267,7 +267,7 @@ Focused on code quality, security, and best practices. --- name: code-reviewer description: Reviews code for best practices, security issues, performance, and maintainability -tools: +tools: - read_file - read_many_files --- @@ -311,7 +311,7 @@ Optimized for React development, hooks, and component patterns. --- name: react-specialist description: Expert in React development, hooks, component patterns, and modern React best practices -tools: +tools: - read_file - write_file - read_many_files diff --git a/integration-tests/context-compress-interactive.test.ts b/integration-tests/context-compress-interactive.test.ts index ddfa6839..68b095ef 100644 --- a/integration-tests/context-compress-interactive.test.ts +++ b/integration-tests/context-compress-interactive.test.ts @@ -21,23 +21,21 @@ describe('Interactive Mode', () => { it.skipIf(process.platform === 'win32')( 'should trigger chat compression with /compress command', async () => { - await rig.setup('interactive-compress-test'); + await rig.setup('interactive-compress-test', { + settings: { + security: { + auth: { + selectedType: 'openai', + }, + }, + }, + }); const { ptyProcess } = rig.runInteractive(); let fullOutput = ''; ptyProcess.onData((data) => (fullOutput += data)); - const authDialogAppeared = await rig.waitForText( - 'How would you like to authenticate', - 5000, - ); - - // select the second option if auth dialog come's up - if (authDialogAppeared) { - ptyProcess.write('2'); - } - // Wait for the app to be ready const isReady = await rig.waitForText('Type your message', 15000); expect( @@ -71,23 +69,21 @@ describe('Interactive Mode', () => { it.skipIf(process.platform === 'win32')( 'should handle compression failure on token inflation', async () => { - await rig.setup('interactive-compress-test'); + await rig.setup('interactive-compress-test', { + settings: { + security: { + auth: { + selectedType: 'openai', + }, + }, + }, + }); const { ptyProcess } = rig.runInteractive(); let fullOutput = ''; ptyProcess.onData((data) => (fullOutput += data)); - const authDialogAppeared = await rig.waitForText( - 'How would you like to authenticate', - 5000, - ); - - // select the second option if auth dialog come's up - if (authDialogAppeared) { - ptyProcess.write('2'); - } - // Wait for the app to be ready const isReady = await rig.waitForText('Type your message', 25000); expect( @@ -106,7 +102,7 @@ describe('Interactive Mode', () => { expect(foundEvent).toBe(true); const compressionFailed = await rig.waitForText( - 'compression was not beneficial', + 'Nothing to compress.', 25000, ); diff --git a/integration-tests/file-system-interactive.test.ts b/integration-tests/file-system-interactive.test.ts index 6927fde9..31a9feb1 100644 --- a/integration-tests/file-system-interactive.test.ts +++ b/integration-tests/file-system-interactive.test.ts @@ -22,21 +22,19 @@ describe('Interactive file system', () => { 'should perform a read-then-write sequence in interactive mode', async () => { const fileName = 'version.txt'; - await rig.setup('interactive-read-then-write'); + await rig.setup('interactive-read-then-write', { + settings: { + security: { + auth: { + selectedType: 'openai', + }, + }, + }, + }); rig.createFile(fileName, '1.0.0'); const { ptyProcess } = rig.runInteractive(); - const authDialogAppeared = await rig.waitForText( - 'How would you like to authenticate', - 5000, - ); - - // select the second option if auth dialog come's up - if (authDialogAppeared) { - ptyProcess.write('2'); - } - // Wait for the app to be ready const isReady = await rig.waitForText('Type your message', 15000); expect( diff --git a/packages/cli/src/ui/components/messages/CompressionMessage.tsx b/packages/cli/src/ui/components/messages/CompressionMessage.tsx index 22c642f7..cd6224e3 100644 --- a/packages/cli/src/ui/components/messages/CompressionMessage.tsx +++ b/packages/cli/src/ui/components/messages/CompressionMessage.tsx @@ -47,7 +47,7 @@ export function CompressionMessage({ case CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR: return 'Could not compress chat history due to a token counting error.'; case CompressionStatus.NOOP: - return 'Chat history is already compressed.'; + return 'Nothing to compress.'; default: return ''; }