@@ -7,6 +7,7 @@ import { describe, expect, test, beforeAll, afterAll } from '@jest/globals';
7
7
import * as vscode from 'vscode' ;
8
8
import * as path from 'path' ;
9
9
import {
10
+ ActivationResult ,
10
11
activateCSharpExtension ,
11
12
describeIfNotGenerator ,
12
13
describeIfNotRazorOrGenerator ,
@@ -39,8 +40,10 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
39
40
let razorFileUri : vscode . Uri ;
40
41
let virtualRazorFileUri : vscode . Uri ;
41
42
43
+ let activation : ActivationResult ;
44
+
42
45
beforeAll ( async function ( ) {
43
- const activation = await activateCSharpExtension ( ) ;
46
+ activation = await activateCSharpExtension ( ) ;
44
47
await testAssetWorkspace . restoreAndWait ( activation ) ;
45
48
46
49
const fileName = 'diagnostics.cs' ;
@@ -53,10 +56,12 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
53
56
virtualRazorFileUri = vscode . Uri . file ( razorFileUri . fsPath + '__virtual.cs' ) ;
54
57
} ) ;
55
58
59
+ afterAll ( async ( ) => {
60
+ await testAssetWorkspace . cleanupWorkspace ( ) ;
61
+ } ) ;
62
+
56
63
describeIfRazor ( 'razor workspace' , ( ) => {
57
64
beforeAll ( async function ( ) {
58
- const activation = await activateCSharpExtension ( ) ;
59
- await testAssetWorkspace . restore ( ) ;
60
65
await vscode . commands . executeCommand ( 'vscode.open' , razorFileUri ) ;
61
66
await testAssetWorkspace . waitForIdle ( activation . eventStream ) ;
62
67
} ) ;
@@ -82,18 +87,11 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
82
87
}
83
88
) ;
84
89
} ) ;
85
-
86
- afterAll ( async ( ) => {
87
- await testAssetWorkspace . cleanupWorkspace ( ) ;
88
- } ) ;
89
90
} ) ;
90
91
91
92
describeIfNotRazorOrGenerator ( 'small workspace (based on maxProjectFileCountForDiagnosticAnalysis setting)' , ( ) => {
92
93
beforeAll ( async function ( ) {
93
- const activation = await activateCSharpExtension ( ) ;
94
- await testAssetWorkspace . restore ( ) ;
95
94
await vscode . commands . executeCommand ( 'vscode.open' , fileUri ) ;
96
-
97
95
await testAssetWorkspace . waitForIdle ( activation . eventStream ) ;
98
96
} ) ;
99
97
@@ -162,10 +160,6 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
162
160
( res ) => expect ( res . length ) . toBeGreaterThan ( 0 )
163
161
) ;
164
162
} ) ;
165
-
166
- afterAll ( async ( ) => {
167
- await testAssetWorkspace . cleanupWorkspace ( ) ;
168
- } ) ;
169
163
} ) ;
170
164
171
165
const describeCondition =
@@ -179,8 +173,6 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
179
173
describeCondition ( 'large workspace (based on maxProjectFileCountForDiagnosticAnalysis setting)' , ( ) => {
180
174
beforeAll ( async function ( ) {
181
175
await setDiagnosticWorkspaceLimit ( 1 ) ;
182
- const activation = await activateCSharpExtension ( ) ;
183
- await testAssetWorkspace . restore ( ) ;
184
176
await restartOmniSharpServer ( ) ;
185
177
await testAssetWorkspace . waitForIdle ( activation . eventStream ) ;
186
178
} ) ;
@@ -208,9 +200,5 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
208
200
( secondaryDiag ) => expect ( secondaryDiag . length ) . toEqual ( 0 )
209
201
) ;
210
202
} ) ;
211
-
212
- afterAll ( async ( ) => {
213
- await testAssetWorkspace . cleanupWorkspace ( ) ;
214
- } ) ;
215
203
} ) ;
216
204
} ) ;
0 commit comments