From efc1dea2d045716ea25311c979f82f683c0cfcc5 Mon Sep 17 00:00:00 2001 From: Grigory Date: Sat, 1 Feb 2025 00:56:06 +0500 Subject: [PATCH] fix flaky test (#386) --- src/test/suite/index.test.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/test/suite/index.test.ts b/src/test/suite/index.test.ts index 635cb4a..63dd883 100644 --- a/src/test/suite/index.test.ts +++ b/src/test/suite/index.test.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as os from 'os' -import { Position, window, workspace, WorkspaceEdit, Uri } from 'vscode' +import { Position, window, workspace, WorkspaceEdit } from 'vscode' import { getFixturePath, getOptionsForFixture, wait } from '../testUtils' import * as utils from 'vscode-test-utils' @@ -291,7 +291,7 @@ suite('EditorConfig extension', function () { }).saveText('foobar') assert(window.activeTextEditor, 'no active editor') - // Before saving, the selection is on line 0. This should remain unchanged. + // Before saving, the selection is on line 0. This should remain unchanged. assert.strictEqual( window.activeTextEditor.selection.start.line, 0, @@ -336,18 +336,13 @@ function withSetting( }, } async function createDoc(contents = '', name = 'test') { - const fixturePath = getFixturePath([rule, value, name]) - - try { - await workspace.fs.delete(Uri.file(fixturePath)) - } catch { - // ignore - } - - const uri = await utils.createFile(contents, fixturePath) + const uri = await utils.createFile( + contents, + getFixturePath([rule, value, name]), + ) const doc = await workspace.openTextDocument(uri) await window.showTextDocument(doc) - await wait(50) // wait for EditorConfig to apply new settings + await wait(100) // wait for EditorConfig to apply new settings return doc } }