Skip to content

Commit

Permalink
test: fix flaky lib test (#8108)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
sapphi-red and antfu committed May 11, 2022
1 parent b993c5f commit 6d84baa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions playground/lib/__tests__/lib.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isBuild, testDir, isServe } from '../../testUtils'
import { isBuild, isServe, testDir, untilUpdated } from '../../testUtils'
import path from 'path'
import fs from 'fs'

Expand Down Expand Up @@ -28,7 +28,10 @@ describe.runIf(isBuild)('build', () => {
})

test('Library mode does not include `preload`', async () => {
expect(await page.textContent('.dynamic-import-message')).toBe('hello vite')
await untilUpdated(
() => page.textContent('.dynamic-import-message'),
'hello vite'
)
const code = fs.readFileSync(
path.join(testDir(), 'dist/lib/dynamic-import-message.js'),
'utf-8'
Expand Down

0 comments on commit 6d84baa

Please sign in to comment.