Skip to content

Commit 85fa846

Browse files
committed
dispose test instantiation service
1 parent f254ad1 commit 85fa846

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/vs/platform/extensionManagement/test/node/installGalleryExtensionTask.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ class TestInstallGalleryExtensionTask extends InstallGalleryExtensionTask {
7070
constructor(
7171
extension: IGalleryExtension,
7272
extensionDownloader: ExtensionsDownloader,
73+
disposables: DisposableStore,
7374
) {
74-
const instantiationService = new TestInstantiationService();
75+
const instantiationService = disposables.add(new TestInstantiationService());
7576
const logService = instantiationService.stub(ILogService, new NullLogService());
7677
const fileService = instantiationService.stub(IFileService, new FileService(logService));
7778
const fileSystemProvider = new InMemoryFileSystemProvider();
@@ -131,7 +132,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
131132
teardown(() => disposables.clear());
132133

133134
test('if verification is enabled by default, the task completes', async () => {
134-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }));
135+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }), disposables);
135136

136137
await testObject.run();
137138

@@ -140,7 +141,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
140141
});
141142

142143
test('if verification is enabled in stable, the task completes', async () => {
143-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true, quality: 'stable' }));
144+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true, quality: 'stable' }), disposables);
144145

145146
await testObject.run();
146147

@@ -149,7 +150,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
149150
});
150151

151152
test('if verification is disabled by setting set to false, the task skips verification', async () => {
152-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: false, verificationResult: 'error', didExecute: false }));
153+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: false, verificationResult: 'error', didExecute: false }), disposables);
153154

154155
await testObject.run();
155156

@@ -158,7 +159,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
158159
});
159160

160161
test('if verification is disabled because the module is not loaded, the task skips verification', async () => {
161-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: false, didExecute: false }));
162+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: false, didExecute: false }), disposables);
162163

163164
await testObject.run();
164165

@@ -168,7 +169,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
168169

169170
test('if verification fails to execute, the task completes', async () => {
170171
const errorCode = 'ENOENT';
171-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: false }));
172+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: false }), disposables);
172173

173174
await testObject.run();
174175

@@ -179,7 +180,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
179180
test('if verification fails', async () => {
180181
const errorCode = 'IntegrityCheckFailed';
181182

182-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: true }));
183+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: true }), disposables);
183184

184185
await testObject.run();
185186

@@ -188,7 +189,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
188189
});
189190

190191
test('if verification succeeds, the task completes', async () => {
191-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }));
192+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }), disposables);
192193

193194
await testObject.run();
194195

@@ -197,7 +198,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
197198
});
198199

199200
test('task completes for unsigned extension', async () => {
200-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: false }));
201+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: false }), disposables);
201202

202203
await testObject.run();
203204

@@ -206,7 +207,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
206207
});
207208

208209
test('task completes for an unsigned extension even when signature verification throws error', async () => {
209-
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: 'error', didExecute: true }));
210+
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: 'error', didExecute: true }), disposables);
210211

211212
await testObject.run();
212213

src/vs/workbench/contrib/extensions/test/electron-sandbox/extensionsWorkbenchService.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
6969
uninstallEvent = suiteDisposables.add(new Emitter<UninstallExtensionEvent>());
7070
didUninstallEvent = suiteDisposables.add(new Emitter<DidUninstallExtensionEvent>());
7171

72-
instantiationService = new TestInstantiationService();
72+
instantiationService = suiteDisposables.add(new TestInstantiationService());
7373
instantiationService.stub(ITelemetryService, NullTelemetryService);
7474
instantiationService.stub(ILogService, NullLogService);
7575
instantiationService.stub(IProgressService, ProgressService);

0 commit comments

Comments
 (0)