mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
18 lines
514 B
TypeScript
18 lines
514 B
TypeScript
import fetch from 'node-fetch'
|
|
import { expect, test } from 'vitest'
|
|
import { port } from './serve'
|
|
import { isBuild, page, untilUpdated } from '~utils'
|
|
|
|
const url = `http://localhost:${port}/`
|
|
|
|
test.runIf(!isBuild)('optimize', async () => {
|
|
await page.goto(url)
|
|
// reload page to get optimized missing deps
|
|
await page.reload()
|
|
await untilUpdated(() => page.textContent('div'), 'Client')
|
|
|
|
// raw http request
|
|
const aboutHtml = await (await fetch(url)).text()
|
|
expect(aboutHtml).toContain('Server')
|
|
})
|