hmr-full-bundle-mode.spec.ts — vite Source File
Architecture documentation for hmr-full-bundle-mode.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0cea2235_196b_0085_420f_b3427a9a630e["hmr-full-bundle-mode.spec.ts"] a5c7c181_0893_2e07_7f10_9bbf5d2e3bab["promises"] 0cea2235_196b_0085_420f_b3427a9a630e --> a5c7c181_0893_2e07_7f10_9bbf5d2e3bab a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 0cea2235_196b_0085_420f_b3427a9a630e --> a340ba46_b2b7_3048_3bb3_6907a74c8464 d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"] 0cea2235_196b_0085_420f_b3427a9a630e --> d3fd5575_295b_d6be_24dd_62d277645dc9 style 0cea2235_196b_0085_420f_b3427a9a630e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { setTimeout } from 'node:timers/promises'
import { expect, test } from 'vitest'
import { editFile, isBuild, page } from '~utils'
const assetUrl = /asset-[\w-]+\.png/
if (isBuild) {
test('should render', async () => {
expect(await page.textContent('h1')).toContain('HMR Full Bundle Mode')
await expect.poll(() => page.textContent('.app')).toBe('hello')
await expect.poll(() => page.textContent('.hmr')).toBe('hello')
})
} else {
// INITIAL -> BUNDLING -> BUNDLED
test('show bundling in progress', async () => {
const reloadPromise = page.waitForEvent('load')
await expect
.poll(() => page.textContent('body'))
.toContain('Bundling in progress')
await reloadPromise // page shown after reload
await expect.poll(() => page.textContent('h1')).toBe('HMR Full Bundle Mode')
await expect.poll(() => page.textContent('.app')).toBe('hello')
await expect.poll(() => page.textContent('.asset')).toMatch(assetUrl)
await expect
.poll(() => page.textContent('.worker-query'))
.toBe('worker-query')
await expect.poll(() => page.textContent('.worker-url')).toBe('worker-url')
})
// BUNDLED -> GENERATE_HMR_PATCH -> BUNDLING -> BUNDLE_ERROR -> BUNDLING -> BUNDLED
test('handle bundle error', async () => {
editFile('main.js', (code) =>
code.replace("text('.app', 'hello')", "text('.app', 'hello'); text("),
)
await expect.poll(() => page.isVisible('vite-error-overlay')).toBe(true)
editFile('main.js', (code) =>
code.replace("text('.app', 'hello'); text(", "text('.app', 'hello')"),
)
await expect.poll(() => page.isVisible('vite-error-overlay')).toBe(false)
await expect.poll(() => page.textContent('.app')).toBe('hello')
})
// BUNDLED -> GENERATE_HMR_PATCH -> BUNDLING -> BUNDLED
test('update bundle', async () => {
editFile('main.js', (code) =>
code.replace("text('.app', 'hello')", "text('.app', 'hello1')"),
)
await expect.poll(() => page.textContent('.app')).toBe('hello1')
editFile('main.js', (code) =>
code.replace("text('.app', 'hello1')", "text('.app', 'hello')"),
)
await expect.poll(() => page.textContent('.app')).toBe('hello')
await expect.poll(() => page.textContent('.asset')).toMatch(assetUrl)
})
// BUNDLED -> GENERATE_HMR_PATCH -> BUNDLING -> BUNDLING -> BUNDLED
test('debounce bundle', async () => {
editFile('main.js', (code) =>
code.replace(
// ... (119 more lines)
Dependencies
- promises
- vitest
- ~utils
Source
Frequently Asked Questions
What does hmr-full-bundle-mode.spec.ts do?
hmr-full-bundle-mode.spec.ts is a source file in the vite codebase, written in typescript.
What does hmr-full-bundle-mode.spec.ts depend on?
hmr-full-bundle-mode.spec.ts imports 3 module(s): promises, vitest, ~utils.
Where is hmr-full-bundle-mode.spec.ts in the architecture?
hmr-full-bundle-mode.spec.ts is located at playground/hmr-full-bundle-mode/__tests__/hmr-full-bundle-mode.spec.ts (directory: playground/hmr-full-bundle-mode/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free