# writing-dev-server-tests > Guides writing HMR/Dev Server tests in test/bake/. Use when creating or modifying dev server, hot reloading, or bundling tests. - Author: SUZUKI Sosuke - Repository: Rohan-flutterint/bun - Version: 20260209214820 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-09 - Source: https://github.com/Rohan-flutterint/bun - Web: https://mule.run/skillshub/@@Rohan-flutterint/bun~writing-dev-server-tests:20260209214820 --- --- name: writing-dev-server-tests description: Guides writing HMR/Dev Server tests in test/bake/. Use when creating or modifying dev server, hot reloading, or bundling tests. --- # Writing HMR/Dev Server Tests Dev server tests validate hot-reloading robustness and reliability. ## File Structure - `test/bake/bake-harness.ts` - shared utilities: `devTest`, `prodTest`, `devAndProductionTest`, `Dev` class, `Client` class - `test/bake/client-fixture.mjs` - subprocess for `Client` (page loading, IPC queries) - `test/bake/dev/*.test.ts` - dev server and hot reload tests - `test/bake/dev-and-prod.ts` - tests running on both dev and production mode ## Test Categories - `bundle.test.ts` - DevServer-specific bundling bugs - `css.test.ts` - CSS bundling issues - `plugins.test.ts` - development mode plugins - `ecosystem.test.ts` - library compatibility (prefer concrete bugs over full package tests) - `esm.test.ts` - ESM features in development - `html.test.ts` - HTML file handling - `react-spa.test.ts` - React, react-refresh transform, server components - `sourcemap.test.ts` - source map correctness ## devTest Basics ```ts import { devTest, emptyHtmlFile } from "../bake-harness"; devTest("html file is watched", { files: { "index.html": emptyHtmlFile({ scripts: ["/script.ts"], body: "