chore(test): fix flaky tsconfig.json test (#53132)

This test was [sometimes failing](

https://github.com/vercel/next.js/actions/runs/5649220907/job/15303327768?pr=53130#step:27:230)
because the `tsconfig.json` is [written as an empty
object](a26bac9604/packages/next/src/lib/typescript/writeConfigurationDefaults.ts (L123-L125)).

This PR makes sure the test waits until the tsconfig.json file is
written with the complete contents.
This commit is contained in:
Steven 2023-07-24 17:33:55 -04:00 committed by GitHub
parent d8f4fa8946
commit 8dede2a4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,13 +28,14 @@ describe('correct tsconfig.json defaults', () => {
await next.start()
let content: string
// wait for tsconfig to be written
await check(async () => {
await next.readFile('tsconfig.json')
return 'success'
}, 'success')
content = await next.readFile('tsconfig.json')
return content && content !== '{}' ? 'ready' : 'retry'
}, 'ready')
const tsconfig = JSON.parse(await next.readFile('tsconfig.json'))
const tsconfig = JSON.parse(content)
expect(next.cliOutput).not.toContain('moduleResolution')
expect(tsconfig.compilerOptions).toEqual(