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 Nov 12, 2024
1 parent c91e38d commit 7311ef0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/src/node/server/environments/rolldown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface RolldownDevOptions {
reactRefresh?: boolean
}

// TODO: polish logging
const logger = createLogger('info', {
prefix: '[rolldown]',
allowClearScreen: false,
Expand Down
22 changes: 22 additions & 0 deletions playground/rolldown-dev-react/__tests__/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test } from 'vitest'
import { editFile, page, viteTestUrl } from '../../test-utils'

test('basic', async () => {
await page.getByRole('button', { name: 'Count: 0' }).click()
await page.getByRole('button', { name: 'Count: 1' }).click()
await page
.getByText('[virtual] test:virtual:ok, environment.name: client')
.click()
await page.getByText('[alias] test-alias-dest:ok').click()
})

test('hmr', async () => {
await page.goto(viteTestUrl)
await page.getByRole('button', { name: 'Count: 0' }).click()

editFile('./src/app.tsx', (s) => s.replace('Count:', 'Count-x:'))
await page.getByRole('button', { name: 'Count-x: 1' }).click()

editFile('./src/app.tsx', (s) => s.replace('Count-x:', 'Count-x-y:'))
await page.getByRole('button', { name: 'Count-x-y: 2' }).click()
})

0 comments on commit 7311ef0

Please sign in to comment.