@@ -48,6 +48,7 @@ import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environ
4848import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
4949import { timeout } from 'vs/base/common/async' ;
5050import { VSBuffer } from 'vs/base/common/buffer' ;
51+ import { DisposableStore } from 'vs/base/common/lifecycle' ;
5152
5253class TestEnvironmentService extends NativeWorkbenchEnvironmentService {
5354
@@ -721,6 +722,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
721722 let workspaceName = `testWorkspace${ uuid . generateUuid ( ) } ` , parentResource : string , workspaceDir : string , testObject : IConfigurationService , globalSettingsFile : string , globalTasksFile : string , workspaceService : WorkspaceService ;
722723 const configurationRegistry = Registry . as < IConfigurationRegistry > ( ConfigurationExtensions . Configuration ) ;
723724 let fileService : IFileService ;
725+ let disposableStore : DisposableStore = new DisposableStore ( ) ;
724726
725727 suiteSetup ( ( ) => {
726728 configurationRegistry . registerConfiguration ( {
@@ -773,13 +775,13 @@ suite('WorkspaceConfigurationService - Folder', () => {
773775 const diskFileSystemProvider = new DiskFileSystemProvider ( new NullLogService ( ) ) ;
774776 fileService . registerProvider ( Schemas . file , diskFileSystemProvider ) ;
775777 fileService . registerProvider ( Schemas . userData , new FileUserDataProvider ( environmentService . appSettingsHome , environmentService . backupHome , diskFileSystemProvider , environmentService ) ) ;
776- workspaceService = new WorkspaceService ( { configurationCache : new ConfigurationCache ( environmentService ) } , environmentService , fileService , remoteAgentService ) ;
778+ workspaceService = disposableStore . add ( new WorkspaceService ( { configurationCache : new ConfigurationCache ( environmentService ) } , environmentService , fileService , remoteAgentService ) ) ;
777779 instantiationService . stub ( IWorkspaceContextService , workspaceService ) ;
778780 instantiationService . stub ( IConfigurationService , workspaceService ) ;
779781 instantiationService . stub ( IEnvironmentService , environmentService ) ;
780782
781783 // Watch workspace configuration directory
782- fileService . watch ( joinPath ( URI . file ( workspaceDir ) , '.vscode' ) ) ;
784+ disposableStore . add ( fileService . watch ( joinPath ( URI . file ( workspaceDir ) , '.vscode' ) ) ) ;
783785
784786 return workspaceService . initialize ( convertToWorkspacePayload ( URI . file ( folderDir ) ) ) . then ( ( ) => {
785787 instantiationService . stub ( IFileService , fileService ) ;
@@ -793,9 +795,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
793795 } ) ;
794796
795797 teardown ( ( ) => {
796- if ( testObject ) {
797- ( < WorkspaceService > testObject ) . dispose ( ) ;
798- }
798+ disposableStore . clear ( ) ;
799799 if ( parentResource ) {
800800 return pfs . rimraf ( parentResource , pfs . RimRafMode . MOVE ) ;
801801 }
0 commit comments