Skip to content

chore(watch): extend Vite HMR to html-reporter and trace viewer#40402

Merged
pavelfeldman merged 2 commits intomicrosoft:mainfrom
pavelfeldman:hmr-all
Apr 24, 2026
Merged

chore(watch): extend Vite HMR to html-reporter and trace viewer#40402
pavelfeldman merged 2 commits intomicrosoft:mainfrom
pavelfeldman:hmr-all

Conversation

@pavelfeldman
Copy link
Copy Markdown
Member

Summary

  • Factor the dashboard's Vite dev-server wiring onto HttpServer.createViteDevServer so html-reporter, trace viewer, and UI mode can reuse it.
  • Serve html-reporter, trace viewer, and UI mode through the embedded Vite dev server in watch builds (skip their vite build --watch steps). Release builds keep the static branch and DCE the dev-server arm.
  • Unify the HMR switch: __PW_HMR__ baked-in flag + PW_HMR_STATIC=1 runtime override (replaces the dashboard-only __PW_DASHBOARD_HMR__ / PW_DASHBOARD_STATIC).
  • The trace viewer service worker still ships from its separate vite.sw.config.ts build and is served directly by the route handler.

- Add HttpServer.notFoundFallback helper and drop the duplicated
  404 closure in dashboard, trace viewer, and html-reporter.
- Trim createViteDevServer options to { root, base? } — no caller
  uses configFile or hmrPath.
- Drop the TOCTOU fs.existsSync + fs.statSync pre-check in
  serveHtmlReportWithHMR; serveFile already returns false on miss.
- Dedupe url.searchParams.get('path') in serveTraceDataRoute.
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:812 › should update state on subsequent run `@windows-latest-node20`

41453 passed, 847 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [firefox] › mcp/http.spec.ts:103 › http transport browser lifecycle (isolated) @mcp-windows-latest
❌ [firefox] › mcp/http.spec.ts:142 › http transport browser sigint @mcp-windows-latest

6609 passed, 916 skipped


Merge workflow run.

@pavelfeldman pavelfeldman merged commit 4adbb8a into microsoft:main Apr 24, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants