@@ -255,6 +255,14 @@ suite('Integration: Interpreter Selection Priority', function () {
255255 // Set environment first time
256256 await api . setEnvironment ( undefined , env ) ;
257257
258+ // Wait for any async config changes to settle before testing idempotency
259+ await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) ) ;
260+
261+ // Verify the environment was actually set
262+ const currentEnv = await api . getEnvironment ( undefined ) ;
263+ assert . ok ( currentEnv , 'Environment should be set before idempotency test' ) ;
264+ assert . strictEqual ( currentEnv . envId . id , env . envId . id , 'Environment should match what we just set' ) ;
265+
258266 const handler = new TestEventHandler < DidChangeEnvironmentEventArgs > (
259267 api . onDidChangeEnvironment ,
260268 'onDidChangeEnvironment' ,
@@ -284,7 +292,7 @@ suite('Integration: Interpreter Selection Priority', function () {
284292 }
285293 } else {
286294 // No event fired - this is the ideal idempotent behavior
287- console . log ( 'No event fired for same env selection (idempotent behavior) ' ) ;
295+ assert . ok ( ! handler . fired , 'No event should fire when setting same environment ' ) ;
288296 }
289297 } finally {
290298 handler . dispose ( ) ;
@@ -353,7 +361,7 @@ suite('Integration: Interpreter Selection Priority', function () {
353361 // but the explicit selection should be cleared
354362 } else {
355363 // Undefined is a valid result - no auto-discovery available
356- console . log ( 'Selection cleared, no auto-discovery fallback ') ;
364+ assert . strictEqual ( autoEnv , undefined , 'Cleared selection with no auto-discovery should return undefined ') ;
357365 }
358366 } ) ;
359367} ) ;
0 commit comments