Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/test/common/utils.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import assert from 'assert';
7
import { LanguagesRegistry } from '../../../editor/common/services/languagesRegistry.js';
8
9
/**
10
* This function is called before test running and also again at the end of test running
11
* and can be used to add assertions. e.g. that registries are empty, etc.
12
*
13
* !! This is called directly by the testing framework.
14
*
15
* @skipMangle
16
*/
17
export function assertCleanState(): void {
18
// If this test fails, it is a clear indication that
19
// your test or suite is leaking services (e.g. via leaking text models)
20
// assert.strictEqual(LanguageService.instanceCount, 0, 'No leaking ILanguageService');
21
assert.strictEqual(LanguagesRegistry.instanceCount, 0, 'Error: Test run should not leak in LanguagesRegistry.');
22
}
23
24