Skip to content

Commit

Permalink
SLVSCODE-972 try fix flaky autobinding test
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Jan 3, 2025
1 parent 57c0c93 commit 62cf819
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions test/suite/autobinding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ suite('Auto Binding Test Suite', () => {
.getConfiguration(SONARLINT_CATEGORY, folder.uri)
.update(BINDING_SETTINGS, undefined, VSCode.ConfigurationTarget.WorkspaceFolder);
}));
deleteSettingsFiles();
});

test('Should show binding suggestion notification', async () => {
Expand Down Expand Up @@ -439,22 +438,13 @@ suite('Auto Binding Test Suite', () => {
});
});

async function deleteSettingsFiles() {
async function cleanBindings() {
const workspaceFolders = VSCode.workspace.workspaceFolders;
if (workspaceFolders) {
for (const folder of workspaceFolders) {
const settingsUri = VSCode.Uri.joinPath(folder.uri, '.vscode', 'settings.json');
try {
await VSCode.workspace.fs.delete(settingsUri, { recursive: true, useTrash: false });
} catch (error) {
console.error(`Failed to delete settings file: ${settingsUri.fsPath}`, error);
}
await VSCode.workspace
.getConfiguration(SONARLINT_CATEGORY, folder.uri)
.update(BINDING_SETTINGS, undefined, VSCode.ConfigurationTarget.WorkspaceFolder);
}
}
}

async function cleanBindings() {
return VSCode.workspace
.getConfiguration(SONARLINT_CATEGORY, VSCode.workspace.workspaceFolders[0].uri)
.update(BINDING_SETTINGS, undefined, VSCode.ConfigurationTarget.WorkspaceFolder);
}

0 comments on commit 62cf819

Please sign in to comment.