Skip to content

Commit efc1dea

Browse files
fix flaky test (#386)
1 parent 9f87be5 commit efc1dea

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/test/suite/index.test.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as assert from 'assert'
22
import * as os from 'os'
3-
import { Position, window, workspace, WorkspaceEdit, Uri } from 'vscode'
3+
import { Position, window, workspace, WorkspaceEdit } from 'vscode'
44
import { getFixturePath, getOptionsForFixture, wait } from '../testUtils'
55

66
import * as utils from 'vscode-test-utils'
@@ -291,7 +291,7 @@ suite('EditorConfig extension', function () {
291291
}).saveText('foobar')
292292
assert(window.activeTextEditor, 'no active editor')
293293

294-
// Before saving, the selection is on line 0. This should remain unchanged.
294+
// Before saving, the selection is on line 0. This should remain unchanged.
295295
assert.strictEqual(
296296
window.activeTextEditor.selection.start.line,
297297
0,
@@ -336,18 +336,13 @@ function withSetting(
336336
},
337337
}
338338
async function createDoc(contents = '', name = 'test') {
339-
const fixturePath = getFixturePath([rule, value, name])
340-
341-
try {
342-
await workspace.fs.delete(Uri.file(fixturePath))
343-
} catch {
344-
// ignore
345-
}
346-
347-
const uri = await utils.createFile(contents, fixturePath)
339+
const uri = await utils.createFile(
340+
contents,
341+
getFixturePath([rule, value, name]),
342+
)
348343
const doc = await workspace.openTextDocument(uri)
349344
await window.showTextDocument(doc)
350-
await wait(50) // wait for EditorConfig to apply new settings
345+
await wait(100) // wait for EditorConfig to apply new settings
351346
return doc
352347
}
353348
}

0 commit comments

Comments
 (0)