@@ -37,6 +37,10 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
3737 [ "anthropic" , "claude-sonnet-4-5" ] ,
3838] ;
3939
40+ // Use Anthropic by default for provider-agnostic tests (faster and cheaper)
41+ const DEFAULT_PROVIDER = "anthropic" ;
42+ const DEFAULT_MODEL = "claude-sonnet-4-5" ;
43+
4044// Integration test timeout guidelines:
4145// - Individual tests should complete within 10 seconds when possible
4246// - Use tight timeouts (5-10s) for event waiting to fail fast
@@ -55,8 +59,9 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
5559 const { loadTokenizerModules } = await import ( "../../src/utils/main/tokenizer" ) ;
5660 await loadTokenizerModules ( ) ;
5761 } , 30000 ) ; // 30s timeout for tokenizer loading
58- // Run tests for each provider concurrently
59- describe . each ( PROVIDER_CONFIGS ) ( "%s:%s provider tests" , ( provider , model ) => {
62+
63+ // Smoke test - verify each provider works
64+ describe . each ( PROVIDER_CONFIGS ) ( "%s:%s smoke test" , ( provider , model ) => {
6065 test . concurrent (
6166 "should successfully send message and receive response" ,
6267 async ( ) => {
@@ -91,6 +96,12 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
9196 } ,
9297 15000
9398 ) ;
99+ } ) ;
100+
101+ // Core functionality tests - using single provider (these test IPC/streaming, not provider-specific behavior)
102+ describe ( "core functionality" , ( ) => {
103+ const provider = DEFAULT_PROVIDER ;
104+ const model = DEFAULT_MODEL ;
94105
95106 test . concurrent (
96107 "should interrupt streaming with interruptStream()" ,
@@ -269,11 +280,6 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
269280 test . concurrent (
270281 "should handle reconnection during active stream" ,
271282 async ( ) => {
272- // Only test with Anthropic (faster and more reliable for this test)
273- if ( provider === "openai" ) {
274- return ;
275- }
276-
277283 const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
278284 try {
279285 // Start a stream with tool call that takes a long time
@@ -554,11 +560,7 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
554560 expect ( result . success ) . toBe ( true ) ;
555561
556562 // Wait for stream to complete
557- const collector = await waitForStreamSuccess (
558- env . sentEvents ,
559- workspaceId ,
560- provider === "openai" ? 30000 : 10000
561- ) ;
563+ const collector = await waitForStreamSuccess ( env . sentEvents , workspaceId , 10000 ) ;
562564
563565 // Get the final assistant message
564566 const finalMessage = collector . getFinalMessage ( ) ;
@@ -783,50 +785,6 @@ These are general instructions that apply to all modes.
783785 ) ;
784786 } ) ;
785787
786- // Provider parity tests - ensure both providers handle the same scenarios
787- describe ( "provider parity" , ( ) => {
788- test . concurrent (
789- "both providers should handle the same message" ,
790- async ( ) => {
791- const results : Record < string , { success : boolean ; responseLength : number } > = { } ;
792-
793- for ( const [ provider , model ] of PROVIDER_CONFIGS ) {
794- // Create fresh environment with provider setup
795- const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
796-
797- // Send same message to both providers
798- const result = await sendMessageWithModel (
799- env . mockIpcRenderer ,
800- workspaceId ,
801- "Say 'parity test' and nothing else" ,
802- provider ,
803- model
804- ) ;
805-
806- // Collect response
807- const collector = await waitForStreamSuccess ( env . sentEvents , workspaceId , 10000 ) ;
808-
809- results [ provider ] = {
810- success : result . success ,
811- responseLength : collector . getDeltas ( ) . length ,
812- } ;
813-
814- // Cleanup
815- await cleanup ( ) ;
816- }
817-
818- // Verify both providers succeeded
819- expect ( results . openai . success ) . toBe ( true ) ;
820- expect ( results . anthropic . success ) . toBe ( true ) ;
821-
822- // Verify both providers generated responses (non-zero deltas)
823- expect ( results . openai . responseLength ) . toBeGreaterThan ( 0 ) ;
824- expect ( results . anthropic . responseLength ) . toBeGreaterThan ( 0 ) ;
825- } ,
826- 30000
827- ) ;
828- } ) ;
829-
830788 // Error handling tests for API key issues
831789 describe ( "API key error handling" , ( ) => {
832790 test . each ( PROVIDER_CONFIGS ) (
@@ -904,43 +862,31 @@ These are general instructions that apply to all modes.
904862 ) ;
905863 } ) ;
906864
907- // Token limit error handling tests
865+ // Token limit error handling tests - using single provider to reduce test time (expensive test)
908866 describe ( "token limit error handling" , ( ) => {
909- test . each ( PROVIDER_CONFIGS ) (
910- "%s should return error when accumulated history exceeds token limit" ,
911- async ( provider , model ) => {
867+ test . concurrent (
868+ "should return error when accumulated history exceeds token limit" ,
869+ async ( ) => {
870+ const provider = DEFAULT_PROVIDER ;
871+ const model = DEFAULT_MODEL ;
912872 const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
913873 try {
914874 // Build up large conversation history to exceed context limits
915- // Different providers have different limits:
916- // - Anthropic: 200k tokens → need ~40 messages of 50k chars (2M chars total)
917- // - OpenAI: varies by model, use ~80 messages (4M chars total) to ensure we hit the limit
875+ // For Anthropic: 200k tokens → need ~30 messages of 50k chars (1.5M chars total) to exceed
876+ // Reduced from 40 to 30 messages to speed up test while still triggering the error
918877 await buildLargeHistory ( workspaceId , env . config , {
919878 messageSize : 50_000 ,
920- messageCount : provider === "anthropic" ? 40 : 80 ,
879+ messageCount : 30 ,
921880 } ) ;
922881
923882 // Now try to send a new message - should trigger token limit error
924883 // due to accumulated history
925- // Disable auto-truncation to force context error
926- const sendOptions =
927- provider === "openai"
928- ? {
929- providerOptions : {
930- openai : {
931- disableAutoTruncation : true ,
932- forceContextLimitError : true ,
933- } ,
934- } ,
935- }
936- : undefined ;
937884 const result = await sendMessageWithModel (
938885 env . mockIpcRenderer ,
939886 workspaceId ,
940887 "What is the weather?" ,
941888 provider ,
942- model ,
943- sendOptions
889+ model
944890 ) ;
945891
946892 // IPC call itself should succeed (errors come through stream events)
0 commit comments