Fix test that relies on mtimes (#17529)

Fixes a timing issue added to a new unit test on `main`. Going to wait
for the `CI / Linux` unit tests to pass 3 times before merging this.
This commit is contained in:
Philipp Spiess 2025-04-03 17:24:26 +02:00 • committed by GitHub
parent 4200a1ecc4
commit 5a9d1f4d5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -378,7 +378,7 @@ describe('concurrent builds', () => {
})
afterEach(() => rm(dir, { recursive: true, force: true }))
test('the current working directory is used by default', async () => {
test('does experience a race-condition when calling the plugin two times for the same change', async () => {
const spy = vi.spyOn(process, 'cwd')
spy.mockReturnValue(dir)
@ -401,6 +401,8 @@ describe('concurrent builds', () => {
expect(result).toContain('.underline')
// Ensure that the mtime is updated
await new Promise((resolve) => setTimeout(resolve, 100))
await writeFile(
path.join(dir, 'dependency.css'),
css`