ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / configuration / test / common / configurationService.test.ts 401 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
import assert from 'assert' ;
import { VSBuffer } from '../../../../base/common/buffer.js' ;
import { Event } from '../../../../base/common/event.js' ;
import { Schemas } from '../../../../base/common/network.js' ;
import { URI } from '../../../../base/common/uri.js' ;
import { runWithFakedTimers } from '../../../../base/test/common/timeTravelScheduler.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { ConfigurationTarget, isConfigured }
Extensions ConfigurationExtensions IConfigurationRegistry
ConfigurationService
IFileService
FileService
InMemoryFileSystemProvider
NullLogService
FilePolicyService
NullPolicyService
Registry
PolicyCategory
disposables
fileService IFileService
settingsResource
fileService disposables
diskFileSystemProvider disposables
disposables fileService Schemas file diskFileSystemProvider
settingsResource
useFakeTimers
fileService settingsResource VSBuffer
testObject disposables settingsResource fileService
testObject
config testObject
assert config
assert config foo
useFakeTimers
fileService settingsResource VSBuffer
testObject disposables settingsResource fileService
testObject
config testObject
assert config
assert config testworkbench
assert config testworkbench editor
assert config testworkbench editor tabs
useFakeTimers
fileService settingsResource VSBuffer
testObject disposables settingsResource fileService
testObject
config testObject
assert config
useFakeTimers
testObject disposables fileService
testObject
config testObject
assert config
useFakeTimers
testObject disposables settingsResource fileService
testObject
c e
disposables Event testObject onDidChangeConfiguration e e source ConfigurationTarget
assert testObject
fileService settingsResource VSBuffer e
useFakeTimers
testObject disposables settingsResource fileService
fileService settingsResource VSBuffer
testObject
c
disposables Event testObject onDidChangeConfiguration e e source ConfigurationTarget e
assert testObject
fileService settingsResource VSBuffer
useFakeTimers
fileService settingsResource VSBuffer
testObject disposables settingsResource fileService
testObject
config testObject
assert config
assert config foo
fileService settingsResource VSBuffer
testObject
config testObject
assert config
assert config foo
useFakeTimers
configuration
service
testSetting
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables fileService
testObject
setting testObject
assert setting
assert setting configuration service testSetting
fileService settingsResource VSBuffer
testObject disposables settingsResource fileService
testObject
setting testObject
assert setting
assert setting configuration service testSetting
fileService settingsResource VSBuffer
testObject
setting testObject
assert setting
assert setting configuration service testSetting
useFakeTimers
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
res testObject
assert res value
assert res defaultValue
assert res userValue
assert res
res testObject
assert res defaultValue
assert res value
assert res userValue
assert res
fileService settingsResource VSBuffer
testObject
res testObject
assert res defaultValue
assert res userValue
assert res value
assert res
useFakeTimers
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
res testObject
assert res defaultValue
assert res value
assert res userValue
fileService settingsResource VSBuffer
testObject
res testObject
assert res defaultValue
assert res value
assert res userValue
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
testObject
assert testObject
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
testObject
testObject
assert testObject
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
testObject
testObject
inspect testObject
assert inspect userValue
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
testObject
testObject
inspect testObject
assert inspect userValue
testObject disposables settingsResource fileService
testObject
testObject
assert testObject
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
testObject disposables settingsResource fileService
testObject
testObject ConfigurationTarget
assert
e
configurationRegistry Registry ConfigurationExtensions Configuration
configurationRegistry
policy
name
category PolicyCategory Extensions
minimumVersion
localization description key value
logService
policyFile
fileService policyFile VSBuffer
policyService disposables policyFile fileService logService
testObject disposables settingsResource fileService policyService logService
testObject
testObject
assert
error
from
'../../common/configuration.js'
;
import
{
as
,
}
from
'../../common/configurationRegistry.js'
;
import
{
}
from
'../../common/configurationService.js'
;
import
{
}
from
'../../../files/common/files.js'
;
import
{
}
from
'../../../files/common/fileService.js'
;
import
{
}
from
'../../../files/common/inMemoryFilesystemProvider.js'
;
import
{
}
from
'../../../log/common/log.js'
;
import
{
}
from
'../../../policy/common/filePolicyService.js'
;
import
{
}
from
'../../../policy/common/policy.js'
;
import
{
}
from
'../../../registry/common/platform.js'
;
import
{
}
from
'../../../../base/common/policy.js'
;
suite
(
'ConfigurationService.test.ts'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
let
:
;
let
:
URI
;
setup
(
async
(
)
=>
{
=
.
add
(
new
FileService
(
new
NullLogService
(
)
)
)
;
const
=
.
add
(
new
InMemoryFileSystemProvider
(
)
)
;
.
add
(
.
registerProvider
(
.
,
)
)
;
=
URI
.
file
(
'settings.json'
)
;
}
)
;
test
(
'simple'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
await
.
writeFile
(
,
.
fromString
(
'{ "foo": "bar" }'
)
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
getValue < {
foo: string ;
} >
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
,
'bar'
)
;
}
)
)
;
test
(
'config gets flattened'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
await
.
writeFile
(
,
.
fromString
(
'{ "testworkbench.editor.tabs": true }'
)
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
getValue < {
testworkbench: {
editor: {
tabs: boolean ;
} ;
} ;
} >
(
)
;
.
ok
(
)
;
.
ok
(
.
)
;
.
ok
(
.
.
)
;
.
strictEqual
(
.
.
.
,
true
)
;
}
)
)
;
test
(
'error case does not explode'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
await
.
writeFile
(
,
.
fromString
(
',,,,'
)
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
getValue < {
foo: string ;
} >
(
)
;
.
ok
(
)
;
}
)
)
;
test
(
'missing file does not explode'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
const
=
.
add
(
new
ConfigurationService
(
URI
.
file
(
'__testFile'
)
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
getValue < { foo: string } >
(
)
;
.
ok
(
)
;
}
)
)
;
test
(
'trigger configuration change event when file does not exist'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
return
new
Promise < void >
(
(
,
)
=>
{
.
add
(
.
filter
(
.
,
=>
.
===
.
USER
)
(
(
)
=>
{
.
strictEqual
(
.
getValue
(
'foo'
)
,
'bar'
)
;
c
(
)
;
}
)
)
;
.
writeFile
(
,
.
fromString
(
'{ "foo": "bar" }'
)
)
.
catch
(
)
;
}
)
;
}
)
)
;
test
(
'trigger configuration change event when file exists'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "foo": "bar" }'
)
)
;
await
.
initialize
(
)
;
return
new
Promise < void >
(
(
)
=>
{
.
add
(
.
filter
(
.
,
=>
.
===
.
USER
)
(
async
(
)
=>
{
.
strictEqual
(
.
getValue
(
'foo'
)
,
'barz'
)
;
c
(
)
;
}
)
)
;
.
writeFile
(
,
.
fromString
(
'{ "foo": "barz" }'
)
)
;
}
)
;
}
)
)
;
test
(
'reloadConfiguration'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
await
.
writeFile
(
,
.
fromString
(
'{ "foo": "bar" }'
)
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
let
=
.
getValue < {
foo: string ;
} >
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
,
'bar'
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "foo": "changed" }'
)
)
;
await
.
reloadConfiguration
(
)
;
=
.
getValue < {
foo: string ;
} >
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
,
'changed'
)
;
}
)
)
;
test
(
'model defaults'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
interface
ITestSetting
{
:
{
:
{
:
string
;
}
;
}
;
}
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configuration.service.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
let
=
.
add
(
new
ConfigurationService
(
URI
.
file
(
'__testFile'
)
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
let
=
.
getValue < ITestSetting>
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
.
.
,
'isSet'
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "testworkbench.editor.tabs": true }'
)
)
;
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
=
.
getValue < ITestSetting>
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
.
.
,
'isSet'
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "configuration.service.testSetting": "isChanged" }'
)
)
;
await
.
reloadConfiguration
(
)
;
=
.
getValue < ITestSetting>
(
)
;
.
ok
(
)
;
.
strictEqual
(
.
.
.
,
'isChanged'
)
;
}
)
)
;
test
(
'lookup'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'lookup.service.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
let
=
.
inspect
(
'something.missing'
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
isConfigured
(
)
,
false
)
;
=
.
inspect
(
'lookup.service.testSetting'
)
;
.
strictEqual
(
.
,
'isSet'
)
;
.
strictEqual
(
.
,
'isSet'
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
isConfigured
(
)
,
false
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "lookup.service.testSetting": "bar" }'
)
)
;
await
.
reloadConfiguration
(
)
;
=
.
inspect
(
'lookup.service.testSetting'
)
;
.
strictEqual
(
.
,
'isSet'
)
;
.
strictEqual
(
.
,
'bar'
)
;
.
strictEqual
(
.
,
'bar'
)
;
.
strictEqual
(
isConfigured
(
)
,
true
)
;
}
)
)
;
test
(
'lookup with null'
,
(
)
=>
runWithFakedTimers < void >
(
{
:
true
}
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_testNull'
,
'type'
:
'object'
,
'properties'
:
{
'lookup.service.testNullSetting'
:
{
'type'
:
'null'
,
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
let
=
.
inspect
(
'lookup.service.testNullSetting'
)
;
.
strictEqual
(
.
,
null
)
;
.
strictEqual
(
.
,
null
)
;
.
strictEqual
(
.
,
undefined
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "lookup.service.testNullSetting": null }'
)
)
;
await
.
reloadConfiguration
(
)
;
=
.
inspect
(
'lookup.service.testNullSetting'
)
;
.
strictEqual
(
.
,
null
)
;
.
strictEqual
(
.
,
null
)
;
.
strictEqual
(
.
,
null
)
;
}
)
)
;
test
(
'update configuration'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'value'
)
;
.
strictEqual
(
.
getValue
(
'configurationService.testSetting'
)
,
'value'
)
;
}
)
;
test
(
'update configuration when exist'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'value'
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'updatedValue'
)
;
.
strictEqual
(
.
getValue
(
'configurationService.testSetting'
)
,
'updatedValue'
)
;
}
)
;
test
(
'update configuration to default value should remove'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'value'
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'isSet'
)
;
const
=
.
inspect
(
'configurationService.testSetting'
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'update configuration should remove when undefined is passed'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
'value'
)
;
await
.
updateValue
(
'configurationService.testSetting'
,
undefined
)
;
const
=
.
inspect
(
'configurationService.testSetting'
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'update unknown configuration'
,
async
(
)
=>
{
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
await
.
updateValue
(
'configurationService.unknownSetting'
,
'value'
)
;
.
strictEqual
(
.
getValue
(
'configurationService.unknownSetting'
)
,
'value'
)
;
}
)
;
test
(
'update configuration in non user target throws error'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.testSetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
}
}
}
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
new
NullPolicyService
(
)
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
try
{
await
.
updateValue
(
'configurationService.testSetting'
,
'value'
,
.
WORKSPACE
)
;
.
fail
(
'Should fail with error'
)
;
}
catch
(
)
{
}
}
)
;
test
(
'update configuration throws error for policy setting'
,
async
(
)
=>
{
const
=
.
as < IConfigurationRegistry>
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'_test'
,
'type'
:
'object'
,
'properties'
:
{
'configurationService.policySetting'
:
{
'type'
:
'string'
,
'default'
:
'isSet'
,
:
{
:
'configurationService.policySetting'
,
:
.
,
:
'1.0.0'
,
:
{
:
{
:
''
,
:
''
}
,
}
}
}
}
}
)
;
const
=
new
NullLogService
(
)
;
const
=
URI
.
file
(
'policies.json'
)
;
await
.
writeFile
(
,
.
fromString
(
'{ "configurationService.policySetting": "policyValue" }'
)
)
;
const
=
.
add
(
new
FilePolicyService
(
,
,
)
)
;
const
=
.
add
(
new
ConfigurationService
(
,
,
,
)
)
;
await
.
initialize
(
)
;
try
{
await
.
updateValue
(
'configurationService.policySetting'
,
'value'
)
;
.
fail
(
'Should throw error'
)
;
}
catch
(
)
{
}
}
)
;
}
)
;