Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(flaky): IGNORE #6001

Closed
wants to merge 5 commits into from
Closed
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
36 changes: 19 additions & 17 deletions packages/core/src/test/shared/fs/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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')
Expand All @@ -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')

Expand All @@ -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')
Expand All @@ -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 () {
Expand Down
Loading