diff --git a/packages/core/src/test/shared/fs/fs.test.ts b/packages/core/src/test/shared/fs/fs.test.ts index 5fa4428559f..ddf62073193 100644 --- a/packages/core/src/test/shared/fs/fs.test.ts +++ b/packages/core/src/test/shared/fs/fs.test.ts @@ -404,8 +404,8 @@ describe('FileSystem', function () { }) }) - describe('rename()', async () => { - it('renames a file', async () => { + describe('rename()', function () { + it('renames a file', async function () { const oldPath = await testFolder.write('oldFile.txt', 'hello world') const newPath = path.join(path.dirname(oldPath), 'newFile.txt') @@ -416,7 +416,7 @@ describe('FileSystem', function () { assert.deepStrictEqual(testutil.getMetrics('ide_fileSystem').length, 0) }) - it('renames a folder', async () => { + it('renames a folder', async function () { const oldPath = await testFolder.mkdir('test') await fs.writeFile(path.join(oldPath, 'file.txt'), 'test text') const newPath = path.join(path.dirname(oldPath), 'newName') @@ -428,7 +428,7 @@ describe('FileSystem', function () { assert(!existsSync(oldPath)) }) - it('overwrites if destination exists', async () => { + it('overwrites if destination exists', async function () { const oldPath = await testFolder.write('oldFile.txt', 'hello world') const newPath = await testFolder.write('newFile.txt', 'some content') @@ -438,7 +438,7 @@ describe('FileSystem', function () { assert(!existsSync(oldPath)) }) - it('throws if source does not exist', async () => { + it('throws if source does not exist', async function () { const clock = testutil.installFakeClock() try { const oldPath = testFolder.pathFrom('oldFile.txt') @@ -459,21 +459,23 @@ describe('FileSystem', function () { } }) - it('source file does not exist at first, but eventually appears', async () => { - const oldPath = testFolder.pathFrom('oldFile.txt') - const newPath = testFolder.pathFrom('newFile.txt') + for (const _ of Array.of({ length: 1000 }, (i: any) => i)) { + it('source file does not exist at first, but eventually appears', async function () { + const oldPath = testFolder.pathFrom('oldFile.txt') + const newPath = testFolder.pathFrom('newFile.txt') - const result = fs.rename(oldPath, newPath) - // this file is created after the first "exists" check fails, the following check should pass - void testutil.toFile('hello world', oldPath) - await result + const result = fs.rename(oldPath, newPath) + // this file is created after the first "exists" check fails, the following check should pass + void testutil.toFile('hello world', oldPath) + await result - testutil.assertTelemetry('ide_fileSystem', { - action: 'rename', - result: 'Succeeded', - reason: 'RenameRaceCondition', + testutil.assertTelemetry('ide_fileSystem', { + action: 'rename', + result: 'Succeeded', + reason: 'RenameRaceCondition', + }) }) - }) + } }) describe('getUserHomeDir()', function () {