Integration tests: Fix Windows flake for Vite watch mode (#14332)

I noticed the Windows integration tests for Vite's `watch` mode have
been flaky. Moving the file write into the retrying assertion callback
seems to fix it and allows us to get rid of the arbitrary timeout (I
don't remember that I ever added this in the first place 😅 ).
This commit is contained in:
Philipp Spiess 2024-09-04 17:09:33 +02:00 • committed by GitHub
parent 719a5351c1
commit 44dd6da4fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -317,21 +317,20 @@ import {
await fs.expectFileToContain(filename, [candidate`underline`, candidate`flex`])
await new Promise((resolve) => setTimeout(resolve, 1000))
// Updates are additive and cause new candidates to be added.
await fs.write(
'project-a/index.html',
html`
<head>
<link rel="stylesheet" href="./src/index.css" />
</head>
<body>
<div class="underline m-2">Hello, world!</div>
</body>
`,
)
await retryAssertion(async () => {
// Updates are additive and cause new candidates to be added.
await fs.write(
'project-a/index.html',
html`
<head>
<link rel="stylesheet" href="./src/index.css" />
</head>
<body>
<div class="underline m-2">Hello, world!</div>
</body>
`,
)
let files = await fs.glob('project-a/dist/**/*.css')
expect(files).toHaveLength(1)
let [, css] = files[0]