@@ -11,6 +11,7 @@ import '../common/extensions';
11
11
import { traceError } from '../common/logger' ;
12
12
import { IConfigurationService , IDisposableRegistry , IExperimentsManager , ILogger , IOutputChannel , Resource } from '../common/types' ;
13
13
import { noop } from '../common/utils/misc' ;
14
+ import { IInterpreterService } from '../interpreter/contracts' ;
14
15
import { IServiceContainer } from '../ioc/types' ;
15
16
import { EventName } from '../telemetry/constants' ;
16
17
import { captureTelemetry , sendTelemetryEvent } from '../telemetry/index' ;
@@ -440,6 +441,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos
440
441
}
441
442
public registerHandlers ( ) {
442
443
const documentManager = this . serviceContainer . get < IDocumentManager > ( IDocumentManager ) ;
444
+ const interpreterService = this . serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
443
445
444
446
this . disposableRegistry . push ( documentManager . onDidSaveTextDocument ( this . onDocumentSaved . bind ( this ) ) ) ;
445
447
this . disposableRegistry . push (
@@ -450,5 +452,10 @@ export class UnitTestManagementService implements ITestManagementService, Dispos
450
452
this . configChangedTimer = setTimeout ( ( ) => this . configurationChangeHandler ( e ) , 1000 ) ;
451
453
} )
452
454
) ;
455
+ this . disposableRegistry . push (
456
+ interpreterService . onDidChangeInterpreter ( ( ) =>
457
+ this . autoDiscoverTests ( undefined ) . catch ( ex => traceError ( 'Failed to auto discover tests upon changing interpreter' , ex ) )
458
+ )
459
+ ) ;
453
460
}
454
461
}
0 commit comments