Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/core/src/test/shared/fs/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,20 @@ describe('FileSystem', 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 existsStub = Sinon.stub(FileSystem.prototype, 'exists')
existsStub.onFirstCall().resolves(false)
existsStub.callThrough()

await testutil.toFile('hello world', oldPath)
await fs.rename(oldPath, newPath)

testutil.assertTelemetry('ide_fileSystem', {
action: 'rename',
result: 'Succeeded',
reason: 'RenameRaceCondition',
})

existsStub.restore()
})
})

Expand Down
Loading