ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / extensionManagement / test / common / allowedExtensionsService.test.ts 234 строк · изменён 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
import * as assert from 'assert' ;
import { AllowedExtensionsService } from '../../common/allowedExtensionsService.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { IProductService } from '../../../product/common/productService.js' ;
import { TestConfigurationService } from '../../../configuration/test/common/testConfigurationService.js' ;
import { AllowedExtensionsConfigKey, IGalleryExtension, ILocalExtension } from '../../common/extensionManagement.js' ;
import { ExtensionType, IExtensionManifest, TargetPlatform }
Event
ConfigurationTarget
getGalleryExtensionId
generateUuid
IStringDictionary
disposables
configurationService
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName prerelease
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName prerelease
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version prerelease
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version targetPlatform TargetPlatform
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version targetPlatform TargetPlatform
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version targetPlatform TargetPlatform
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version targetPlatform TargetPlatform
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName version
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName prerelease
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName prerelease
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject id publisherDisplayName
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
assert testObject
configurationService AllowedExtensionsConfigKey
testObject disposables configurationService
promise Event testObject onDidChangeAllowedExtensionsConfigValue
configurationService onDidChangeConfigurationEmitter affectedKeys AllowedExtensionsConfigKey change keys overrides source ConfigurationTarget
promise
extensionPublisherOrgs IProductService
_serviceBrand
extensionPublisherOrgs
IProductService
name properties Partial IGalleryExtension galleryExtensionProperties IStringDictionary IGalleryExtension
galleryExtension IGalleryExtension Object type name publisher publisherDisplayName version allTargetPlatforms TargetPlatform properties assets isSigned properties
galleryExtension properties galleryExtension properties dependencies galleryExtensionProperties
galleryExtension identifier id galleryExtension publisher galleryExtension name uuid
IGalleryExtension galleryExtension
id manifest Partial IExtensionManifest properties IStringDictionary ILocalExtension
publisher name id
manifest name publisher manifest
properties
identifier id
location
galleryIdentifier id uuid
type ExtensionType User
properties
isValid properties isValid
properties isBuiltin properties type ExtensionType System
ILocalExtension Object manifest properties
from
'../../../extensions/common/extensions.js'
;
import
{
}
from
'../../../../base/common/event.js'
;
import
{
}
from
'../../../configuration/common/configuration.js'
;
import
{
}
from
'../../common/extensionManagementUtil.js'
;
import
{
}
from
'../../../../base/common/uuid.js'
;
import
{
URI
}
from
'../../../../base/common/uri.js'
;
import
{
}
from
'../../../../base/common/collections.js'
;
suite
(
'AllowedExtensionsService'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
=
new
TestConfigurationService
(
)
;
setup
(
(
)
=>
{
.
setUserConfiguration
(
,
'*'
)
;
}
)
;
test
(
'should allow all extensions if no allowed extensions are configured'
,
(
)
=>
{
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
true
)
;
}
)
;
test
(
'should not allow specific extension if not in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
false
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow specific extension if in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
true
)
;
}
)
;
test
(
'should not allow pre-release extension if only stable is allowed'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
'stable'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
true
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow pre-release extension if pre-release is allowed'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
true
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow specific version of an extension when configured to that version'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow any version of an extension when a specific version is configured'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow any version of an extension when stable is configured'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
'stable'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow a version of an extension when stable is configured'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
'stable'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow a pre-release version of an extension when stable is configured'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
'stable'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
,
:
true
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow specific version of an extension when configured to multiple versions'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3'
,
'2.0.1'
,
'3.1.2'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow platform specific version of an extension when configured to platform specific version'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3@darwin-x64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
,
:
.
DARWIN_X64
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow universal platform specific version of an extension when configured to platform specific version'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3@darwin-x64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
,
:
.
UNIVERSAL
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow specific version of an extension when configured to platform specific version'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3@darwin-x64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow platform specific version of an extension when configured to multiple versions'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.0.0'
,
'1.2.3@darwin-x64'
,
'1.2.3@darwin-arm64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
,
:
.
DARWIN_X64
}
)
===
true
,
true
)
;
}
)
;
test
(
'should not allow platform specific version of an extension when configured to different platform specific version'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.2.3@darwin-x64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.2.3'
,
:
.
DARWIN_ARM64
}
)
===
true
,
false
)
;
}
)
;
test
(
'should specific version of an extension when configured to different versions'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test.extension'
:
[
'1.0.0'
,
'1.2.3@darwin-x64'
,
'1.2.3@darwin-arm64'
]
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
'1.0.1'
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow extension if publisher is in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
,
true
)
;
}
)
;
test
(
'should allow extension if publisher is not in allowed list and has publisher mapping'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'hello'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
[
'hello'
]
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
'Hello'
}
)
,
true
)
;
}
)
;
test
(
'should allow extension if publisher is not in allowed list and has different publisher mapping'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'hello'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
[
'bar'
]
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
'Hello'
}
)
===
true
,
false
)
;
}
)
;
test
(
'should not allow extension if publisher is not in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test'
:
false
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
false
)
;
}
)
;
test
(
'should not allow prerelease extension if publisher is allowed only to stable'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test'
:
'stable'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
true
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow extension if publisher is set to random value'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'test'
:
'hello'
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
,
:
true
}
)
===
true
,
true
)
;
}
)
;
test
(
'should allow extension if only wildcard is in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'*'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
,
true
)
;
}
)
;
test
(
'should allow extension if wildcard is in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'*'
:
true
,
'hello'
:
false
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
,
true
)
;
}
)
;
test
(
'should not allow extension if wildcard is not in allowed list'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'*'
:
false
,
'hello'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
{
:
'test.extension'
,
:
undefined
}
)
===
true
,
false
)
;
}
)
;
test
(
'should allow a gallery extension'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'pub'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
aGalleryExtension
(
'name'
)
)
===
true
,
true
)
;
}
)
;
test
(
'should allow a local extension'
,
(
)
=>
{
.
setUserConfiguration
(
,
{
'pub'
:
true
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
.
strictEqual
(
.
isAllowed
(
aLocalExtension
(
'pub.name'
)
)
===
true
,
true
)
;
}
)
;
test
(
'should trigger change event when allowed list change'
,
async
(
)
=>
{
.
setUserConfiguration
(
,
{
'*'
:
false
}
)
;
const
=
.
add
(
new
AllowedExtensionsService
(
aProductService
(
)
,
)
)
;
const
=
.
toPromise
(
.
)
;
.
.
fire
(
{
affectsConfiguration
:
(
)
=>
true
,
:
new
Set
(
[
]
)
,
:
{
:
[
]
,
:
[
]
}
,
:
.
USER
}
)
;
await
;
}
)
;
function
aProductService
(
?
:
string
[
]
)
:
{
return
{
:
undefined
,
}
as
;
}
function
aGalleryExtension
(
:
string
,
:
<
>
=
{
}
,
:
<
unknown
>
=
{
}
)
:
{
const
=
<
>
.
create
(
{
:
'gallery'
,
,
:
'pub'
,
:
'Pub'
,
:
'1.0.0'
,
:
[
.
UNIVERSAL
]
,
:
{
}
,
:
{
}
,
:
true
,
...
}
)
;
.
=
{
...
.
,
:
[
]
,
...
}
;
.
=
{
:
getGalleryExtensionId
(
.
,
.
)
,
:
generateUuid
(
)
}
;
return
<
>
;
}
function
aLocalExtension
(
:
string
,
:
<
>
=
{
}
,
:
<
unknown
>
=
{
}
)
:
{
const
[
,
]
=
.
split
(
'.'
)
;
=
{
,
,
...
}
;
=
{
:
{
}
,
:
URI
.
file
(
` pub. ${ name} `
)
,
:
{
,
:
undefined
}
,
:
.
,
...
,
:
.
??
true
,
}
;
.
=
.
===
.
;
return
<
>
.
create
(
{
,
...
}
)
;
}
}
)
;