hmr.spec.ts — vite Source File
Architecture documentation for hmr.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 33684baf_46fa_aa9d_53c5_6afd046bbf97["hmr.spec.ts"] a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 33684baf_46fa_aa9d_53c5_6afd046bbf97 --> a340ba46_b2b7_3048_3bb3_6907a74c8464 daea26b3_da11_dee8_9ffd_9dbc0e857906["playwright-chromium"] 33684baf_46fa_aa9d_53c5_6afd046bbf97 --> daea26b3_da11_dee8_9ffd_9dbc0e857906 d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"] 33684baf_46fa_aa9d_53c5_6afd046bbf97 --> d3fd5575_295b_d6be_24dd_62d277645dc9 style 33684baf_46fa_aa9d_53c5_6afd046bbf97 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { beforeAll, describe, expect, it, test } from 'vitest'
import type { Page } from 'playwright-chromium'
import {
addFile,
browser,
browserLogs,
editFile,
getBg,
getColor,
isBuild,
page,
readFile,
removeFile,
serverLogs,
untilBrowserLogAfter,
viteTestUrl,
} from '~utils'
test('should render', async () => {
expect(await page.textContent('.app')).toBe('1')
expect(await page.textContent('.dep')).toBe('1')
expect(await page.textContent('.nested')).toBe('1')
})
if (!isBuild) {
test('should connect', async () => {
expect(browserLogs.length).toBe(5)
expect(browserLogs.some((msg) => msg.includes('connected'))).toBe(true)
browserLogs.length = 0
})
const fetchHotEvents = async (): Promise<{
connectCount: number
disconnectCount: number
}> => {
const res = await fetch(viteTestUrl + '/hot-events-counts')
return res.json()
}
test('hot events', async () => {
expect(await fetchHotEvents()).toStrictEqual({
connectCount: 1,
disconnectCount: 0,
})
await untilBrowserLogAfter(() => page.reload(), [/connected/])
expect(await fetchHotEvents()).toStrictEqual({
connectCount: 2,
disconnectCount: 1,
})
})
test('self accept', async () => {
const el = await page.$('.app')
await untilBrowserLogAfter(
() =>
editFile('hmr.ts', (code) =>
code.replace('const foo = 1', 'const foo = 2'),
),
[
'>>> vite:beforeUpdate -- update',
'foo was: 1',
// ... (1101 more lines)
Domain
Subdomains
Functions
Dependencies
- playwright-chromium
- vitest
- ~utils
Source
Frequently Asked Questions
What does hmr.spec.ts do?
hmr.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in hmr.spec.ts?
hmr.spec.ts defines 1 function(s): fetchHotEvents.
What does hmr.spec.ts depend on?
hmr.spec.ts imports 3 module(s): playwright-chromium, vitest, ~utils.
Where is hmr.spec.ts in the architecture?
hmr.spec.ts is located at playground/hmr/__tests__/hmr.spec.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground/hmr/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free