outline test leaks

This commit is contained in:
Aaron Munger
2023-10-03 10:00:47 -07:00
committed by Aaron Munger
parent fcd7ab5a08
commit bc06efacfc
@@ -17,17 +17,22 @@ import { IActiveNotebookEditor, INotebookEditorPane } from 'vs/workbench/contrib
import { DisposableStore } from 'vs/base/common/lifecycle';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { NotebookCellOutline } from 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
suite('Notebook Outline', function () {
let disposables: DisposableStore;
let instantiationService: TestInstantiationService;
suiteSetup(() => {
teardown(() => disposables.dispose());
ensureNoDisposablesAreLeakedInTestSuite();
setup(() => {
disposables = new DisposableStore();
instantiationService = setupInstantiationService(disposables);
instantiationService.set(IEditorService, new class extends mock<IEditorService>() { });
instantiationService.set(IMarkerService, new MarkerService());
instantiationService.set(IMarkerService, disposables.add(new MarkerService()));
instantiationService.set(IThemeService, new class extends mock<IThemeService>() {
override onDidFileIconThemeChange = Event.None;
override getFileIconTheme(): IFileIconTheme {
@@ -36,7 +41,6 @@ suite('Notebook Outline', function () {
});
});
suiteTeardown(() => disposables.dispose());
function withNotebookOutline<R = any>(cells: [source: string, lang: string, kind: CellKind, output?: IOutputDto[], metadata?: NotebookCellMetadata][], callback: (outline: NotebookCellOutline, editor: IActiveNotebookEditor) => R): Promise<R> {
return withTestNotebook(cells, (editor) => {
@@ -49,6 +53,8 @@ suite('Notebook Outline', function () {
}
override onDidChangeModel: Event<void> = Event.None;
}, OutlineTarget.OutlinePane);
disposables.add(outline);
return callback(outline, editor);
});