From 387706607dfa372f4f0c6fee14286bf4a290b258 Mon Sep 17 00:00:00 2001 From: Allen Hutchison Date: Fri, 1 Aug 2025 14:33:33 -0700 Subject: fix(tests): refactor integration tests to be less flaky (#4890) Co-authored-by: matt korwel --- packages/core/src/utils/bfsFileSearch.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/core/src/utils') diff --git a/packages/core/src/utils/bfsFileSearch.test.ts b/packages/core/src/utils/bfsFileSearch.test.ts index 3d5a0010..ce19f80e 100644 --- a/packages/core/src/utils/bfsFileSearch.test.ts +++ b/packages/core/src/utils/bfsFileSearch.test.ts @@ -258,10 +258,12 @@ describe('bfsFileSearch', () => { expect(avgDuration).toBeLessThan(2000); // Very generous limit // Ensure consistency across runs (variance should not be too high) - expect(consistencyRatio).toBeLessThan(1.5); // Max variance should be less than 150% of average + // More tolerant in CI environments where performance can be variable + const maxConsistencyRatio = process.env.CI ? 3.0 : 1.5; + expect(consistencyRatio).toBeLessThan(maxConsistencyRatio); // Max variance should be reasonable console.log( - `✅ Performance test passed: avg=${avgDuration.toFixed(2)}ms, consistency=${(consistencyRatio * 100).toFixed(1)}%`, + `✅ Performance test passed: avg=${avgDuration.toFixed(2)}ms, consistency=${(consistencyRatio * 100).toFixed(1)}% (threshold: ${(maxConsistencyRatio * 100).toFixed(0)}%)`, ); }); }); -- cgit v1.2.3