Skip to content

Commit

Permalink
test: test hmr with new import
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 5, 2024
1 parent 44c7ea2 commit 714079b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion playground/rolldown-dev-react/__tests__/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from 'vitest'
import { editFile, isBuild, page, viteTestUrl } from '../../test-utils'
import { addFile, editFile, isBuild, page, viteTestUrl } from '../../test-utils'

test('basic', async () => {
await page.getByRole('button', { name: 'Count: 0' }).click()
Expand Down Expand Up @@ -77,3 +77,18 @@ test.runIf(!isBuild)('hmr css', async () => {
.toBe('rgb(255, 0, 0)')
await page.getByRole('button', { name: 'Count: 3' }).click()
})

test.runIf(!isBuild).only('hmr new file', async () => {
await page.goto(viteTestUrl)
await page.getByRole('button', { name: 'Count: 0' }).click()

addFile('./src/new-file.ts', 'export default "[new-file:ok]"')
editFile(
'./src/app.tsx',
(s) =>
'import newFile from "./new-file";\n' +
s.replace('Count:', 'Count-{newFile}:'),
)

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

0 comments on commit 714079b

Please sign in to comment.