4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { strictEqual } from 'assert' ;
7
+ import { Event } from 'vs/base/common/event' ;
8
+ import { Schemas } from 'vs/base/common/network' ;
9
+ import { URI } from 'vs/base/common/uri' ;
10
+ import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils' ;
7
11
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
8
- import { TerminalProcessManager } from 'vs/workbench/contrib/terminal/browser/terminalProcessManager' ;
9
12
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService' ;
10
- import { ITestInstantiationService , TestTerminalProfileResolverService , workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices ' ;
13
+ import { NullLogService } from 'vs/platform/log/common/log ' ;
11
14
import { IProductService } from 'vs/platform/product/common/productService' ;
15
+ import { ITerminalChildProcess , ITerminalLogService } from 'vs/platform/terminal/common/terminal' ;
16
+ import { ITerminalConfigurationService , ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal' ;
17
+ import { TerminalConfigurationService } from 'vs/workbench/contrib/terminal/browser/terminalConfigurationService' ;
18
+ import { TerminalProcessManager } from 'vs/workbench/contrib/terminal/browser/terminalProcessManager' ;
12
19
import { IEnvironmentVariableService } from 'vs/workbench/contrib/terminal/common/environmentVariable' ;
13
20
import { EnvironmentVariableService } from 'vs/workbench/contrib/terminal/common/environmentVariableService' ;
14
- import { Schemas } from 'vs/base/common/network' ;
15
- import { URI } from 'vs/base/common/uri' ;
16
- import { ITerminalChildProcess , ITerminalLogService } from 'vs/platform/terminal/common/terminal' ;
17
21
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal' ;
18
- import { ITerminalConfigurationService , ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal' ;
19
- import { DisposableStore } from 'vs/base/common/lifecycle' ;
20
- import { Event } from 'vs/base/common/event' ;
22
+ import { TestTerminalProfileResolverService , workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices' ;
21
23
import { TestProductService } from 'vs/workbench/test/common/workbenchTestServices' ;
22
- import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils' ;
23
- import { NullLogService } from 'vs/platform/log/common/log' ;
24
- import { TerminalConfigurationService } from 'vs/workbench/contrib/terminal/browser/terminalConfigurationService' ;
25
24
26
25
class TestTerminalChildProcess implements ITerminalChildProcess {
27
26
id : number = 0 ;
@@ -82,13 +81,12 @@ class TestTerminalInstanceService implements Partial<ITerminalInstanceService> {
82
81
}
83
82
84
83
suite ( 'Workbench - TerminalProcessManager' , ( ) => {
85
- let store : DisposableStore ;
86
- let instantiationService : ITestInstantiationService ;
87
84
let manager : TerminalProcessManager ;
88
85
86
+ const store = ensureNoDisposablesAreLeakedInTestSuite ( ) ;
87
+
89
88
setup ( async ( ) => {
90
- store = new DisposableStore ( ) ;
91
- instantiationService = workbenchInstantiationService ( undefined , store ) ;
89
+ const instantiationService = workbenchInstantiationService ( undefined , store ) ;
92
90
const configurationService = new TestConfigurationService ( ) ;
93
91
await configurationService . setUserConfiguration ( 'editor' , { fontFamily : 'foo' } ) ;
94
92
await configurationService . setUserConfiguration ( 'terminal' , {
@@ -101,20 +99,16 @@ suite('Workbench - TerminalProcessManager', () => {
101
99
}
102
100
} ) ;
103
101
instantiationService . stub ( IConfigurationService , configurationService ) ;
104
- instantiationService . stub ( ITerminalConfigurationService , instantiationService . createInstance ( TerminalConfigurationService ) ) ;
102
+ instantiationService . stub ( ITerminalConfigurationService , store . add ( instantiationService . createInstance ( TerminalConfigurationService ) ) ) ;
105
103
instantiationService . stub ( IProductService , TestProductService ) ;
106
104
instantiationService . stub ( ITerminalLogService , new NullLogService ( ) ) ;
107
- instantiationService . stub ( IEnvironmentVariableService , instantiationService . createInstance ( EnvironmentVariableService ) ) ;
105
+ instantiationService . stub ( IEnvironmentVariableService , store . add ( instantiationService . createInstance ( EnvironmentVariableService ) ) ) ;
108
106
instantiationService . stub ( ITerminalProfileResolverService , TestTerminalProfileResolverService ) ;
109
107
instantiationService . stub ( ITerminalInstanceService , new TestTerminalInstanceService ( ) ) ;
110
108
111
109
manager = store . add ( instantiationService . createInstance ( TerminalProcessManager , 1 , undefined , undefined , undefined ) ) ;
112
110
} ) ;
113
111
114
- teardown ( ( ) => store . dispose ( ) ) ;
115
-
116
- ensureNoDisposablesAreLeakedInTestSuite ( ) ;
117
-
118
112
suite ( 'process persistence' , ( ) => {
119
113
suite ( 'local' , ( ) => {
120
114
test ( 'regular terminal should persist' , async ( ) => {
0 commit comments