55
66import * as path from 'path' ;
77import * as vscode from 'vscode' ;
8- import { describe , beforeAll , afterAll , test , expect } from '@jest/globals' ;
8+ import { describe , beforeAll , afterAll , test , expect , beforeEach , afterEach } from '@jest/globals' ;
99import testAssetWorkspace from './testAssets/testAssetWorkspace' ;
1010import * as integrationHelpers from './integrationHelpers' ;
1111import { InlayHint , InlayHintKind , Position } from 'vscode-languageserver-protocol' ;
1212
13- describe ( `[${ testAssetWorkspace . description } ] Test LSP Inlay Hints ` , function ( ) {
14- beforeAll ( async function ( ) {
13+ describe ( `[${ testAssetWorkspace . description } ] Test LSP Inlay Hints ` , ( ) => {
14+ beforeAll ( async ( ) => {
1515 const editorConfig = vscode . workspace . getConfiguration ( 'editor' ) ;
1616 await editorConfig . update ( 'inlayHints.enabled' , true ) ;
1717 const dotnetConfig = vscode . workspace . getConfiguration ( 'dotnet' ) ;
@@ -30,14 +30,21 @@ describe(`[${testAssetWorkspace.description}] Test LSP Inlay Hints `, function (
3030 await csharpConfig . update ( 'inlayHints.enableInlayHintsForLambdaParameterTypes' , true ) ;
3131 await csharpConfig . update ( 'inlayHints.enableInlayHintsForImplicitObjectCreation' , true ) ;
3232
33- await integrationHelpers . openFileInWorkspaceAsync ( path . join ( 'src' , 'app' , 'inlayHints.cs' ) ) ;
3433 await integrationHelpers . activateCSharpExtension ( ) ;
3534 } ) ;
3635
36+ beforeEach ( async ( ) => {
37+ await integrationHelpers . openFileInWorkspaceAsync ( path . join ( 'src' , 'app' , 'inlayHints.cs' ) ) ;
38+ } ) ;
39+
3740 afterAll ( async ( ) => {
3841 await testAssetWorkspace . cleanupWorkspace ( ) ;
3942 } ) ;
4043
44+ afterEach ( async ( ) => {
45+ await integrationHelpers . closeAllEditorsAsync ( ) ;
46+ } ) ;
47+
4148 test ( 'Hints retrieved for region' , async ( ) => {
4249 const range = new vscode . Range ( new vscode . Position ( 4 , 8 ) , new vscode . Position ( 15 , 85 ) ) ;
4350 const activeDocument = vscode . window . activeTextEditor ?. document . uri ;
0 commit comments