Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 9, 2024
1 parent 6c00b66 commit eb58c7c
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion playground/rolldown-dev-react/__tests__/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from 'vitest'
import { expect, test, vi } from 'vitest'
import { addFile, editFile, isBuild, page, viteTestUrl } from '../../test-utils'

test('basic', async () => {
Expand Down Expand Up @@ -92,3 +92,28 @@ test.runIf(!isBuild)('hmr new file', async () => {

await page.getByRole('button', { name: 'Count-[new-file:ok]: 1' }).click()
})

test('dynamic import chunk', async () => {
await page.goto(viteTestUrl)
await page.locator('.test-dynamic-import button').click()
await expect
.poll(() => page.textContent('.test-dynamic-import'))
.toContain('[ok]')
})

test.runIf(!isBuild)('dynamic import chunk update', async () => {
await page.goto(viteTestUrl)
editFile('./src/dynamic-import-dep.ts', (s) => s.replace('[ok]', '[ok-edit]'))
await vi.waitFor(
async () => {
await page.locator('.test-dynamic-import button').click()
await expect
.poll(() => page.textContent('.test-dynamic-import'))
.toContain('[ok-edit]')
},
{
timeout: 2000,
interval: 500,
},
)
})

0 comments on commit eb58c7c

Please sign in to comment.