Skip to content

vitest-dev/viewer

 
 

Repository files navigation

Vitest Viewer

View any static site from a zip file — entirely in the browser, no server needed.

Available at viewer.vitest.dev.

A service worker intercepts fetch requests and serves files from the unzipped content via Cache API. The viewer is generic — it doesn't know or care what's inside the zip. Works with Vitest HTML reports, Storybook builds, VitePress sites, or any static site.

Usage

# development
pnpm i
pnpm dev

# deploy production
pnpm release

Then drag-and-drop a zip file onto the page. If the zip contains an index.html, it loads automatically. Otherwise, a directory listing is shown.

How it works

  1. index.html — drop zone UI, unzips with fflate (CDN), stores files in Cache API, registers service worker, loads content in iframe
  2. sw.js — intercepts fetch under /zipview/site/, serves from Cache API, generates directory listings when no index.html is found

That's it. Two files, no build step, no dependencies to install.

Motivation

CI produces static site artifacts (e.g. Vitest HTML reports via --reporter=html). On GitHub Actions, viewing them requires: download zip → unzip → run local static server → open browser.

GitLab CI can preview HTML artifacts directly in the browser (powered by GitLab Pages). GitHub Actions does not.

Inspired by Playwright's trace viewer which uses the same service worker + zip pattern, but for Playwright-specific trace data rather than generic static sites.

Prior art

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 67.0%
  • JavaScript 20.0%
  • TypeScript 13.0%