From aacad995b66689d2eee8739eba7a0b943bdd7010 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:49:11 +0200 Subject: [PATCH] test: retry 10 times in disconnection test --- test/src/disconnect.test.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/src/disconnect.test.ts b/test/src/disconnect.test.ts index 38f5834..dc6b661 100644 --- a/test/src/disconnect.test.ts +++ b/test/src/disconnect.test.ts @@ -24,16 +24,18 @@ suite('Server disconnect', () => { }) test('Should reconnect automatically when server is disconnected', async () => { - await vscode.commands.executeCommand('flix.simulateDisconnect') + for (let i = 0; i < 10; i++) { + await vscode.commands.executeCommand('flix.simulateDisconnect') - // Wait for the server to disconnect, otherwise the next command will hang - await sleep(1000) + // Wait for the server to disconnect, otherwise the next command will hang + await sleep(1000) - // Ensure that the server is reconnected - const docUri = getTestDocUri('src/Main.flix') - const position = new vscode.Position(9, 12) - const r = await vscode.commands.executeCommand('vscode.executeHoverProvider', docUri, position) - const contents = r[0].contents[0] as vscode.MarkdownString - assert.strictEqual(contents.value.includes('Type'), true) + // Ensure that the server is reconnected + const docUri = getTestDocUri('src/Main.flix') + const position = new vscode.Position(9, 12) + const r = await vscode.commands.executeCommand('vscode.executeHoverProvider', docUri, position) + const contents = r[0].contents[0] as vscode.MarkdownString + assert.strictEqual(contents.value.includes('Type'), true) + } }) })