Skip to content

Commit f26d525

Browse files
committed
Attempt to fix O# integration test flakiness
1 parent 901c288 commit f26d525

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

omnisharptest/omnisharpIntegrationTests/diagnostics.integration.test.ts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { describe, expect, test, beforeAll, afterAll } from '@jest/globals';
77
import * as vscode from 'vscode';
88
import * as path from 'path';
99
import {
10+
ActivationResult,
1011
activateCSharpExtension,
1112
describeIfNotGenerator,
1213
describeIfNotRazorOrGenerator,
@@ -39,8 +40,10 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
3940
let razorFileUri: vscode.Uri;
4041
let virtualRazorFileUri: vscode.Uri;
4142

43+
let activation: ActivationResult;
44+
4245
beforeAll(async function () {
43-
const activation = await activateCSharpExtension();
46+
activation = await activateCSharpExtension();
4447
await testAssetWorkspace.restoreAndWait(activation);
4548

4649
const fileName = 'diagnostics.cs';
@@ -53,10 +56,12 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
5356
virtualRazorFileUri = vscode.Uri.file(razorFileUri.fsPath + '__virtual.cs');
5457
});
5558

59+
afterAll(async () => {
60+
await testAssetWorkspace.cleanupWorkspace();
61+
});
62+
5663
describeIfRazor('razor workspace', () => {
5764
beforeAll(async function () {
58-
const activation = await activateCSharpExtension();
59-
await testAssetWorkspace.restore();
6065
await vscode.commands.executeCommand('vscode.open', razorFileUri);
6166
await testAssetWorkspace.waitForIdle(activation.eventStream);
6267
});
@@ -82,18 +87,11 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
8287
}
8388
);
8489
});
85-
86-
afterAll(async () => {
87-
await testAssetWorkspace.cleanupWorkspace();
88-
});
8990
});
9091

9192
describeIfNotRazorOrGenerator('small workspace (based on maxProjectFileCountForDiagnosticAnalysis setting)', () => {
9293
beforeAll(async function () {
93-
const activation = await activateCSharpExtension();
94-
await testAssetWorkspace.restore();
9594
await vscode.commands.executeCommand('vscode.open', fileUri);
96-
9795
await testAssetWorkspace.waitForIdle(activation.eventStream);
9896
});
9997

@@ -162,10 +160,6 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
162160
(res) => expect(res.length).toBeGreaterThan(0)
163161
);
164162
});
165-
166-
afterAll(async () => {
167-
await testAssetWorkspace.cleanupWorkspace();
168-
});
169163
});
170164

171165
const describeCondition =
@@ -179,8 +173,6 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
179173
describeCondition('large workspace (based on maxProjectFileCountForDiagnosticAnalysis setting)', () => {
180174
beforeAll(async function () {
181175
await setDiagnosticWorkspaceLimit(1);
182-
const activation = await activateCSharpExtension();
183-
await testAssetWorkspace.restore();
184176
await restartOmniSharpServer();
185177
await testAssetWorkspace.waitForIdle(activation.eventStream);
186178
});
@@ -208,9 +200,5 @@ describeIfNotGenerator(`DiagnosticProvider: ${testAssetWorkspace.description}`,
208200
(secondaryDiag) => expect(secondaryDiag.length).toEqual(0)
209201
);
210202
});
211-
212-
afterAll(async () => {
213-
await testAssetWorkspace.cleanupWorkspace();
214-
});
215203
});
216204
});

0 commit comments

Comments
 (0)