DEV.co
Open-Source Testing · nvh95

jest-preview

Jest Preview is a browser-based debugger for Jest tests that lets you visualize your component's HTML and styling in real-time while writing tests. It integrates with Jest and react-testing-library, supports multiple frontend frameworks, and handles CSS, CSS-in-JS, and images out of the box.

Source: GitHub — github.com/nvh95/jest-preview
2.4k
GitHub stars
81
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorynvh95/jest-preview
Ownernvh95
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars2.4k
Forks81
Open issues51
Latest releasev0.3.3 (2025-12-14)
Last updated2026-04-25
Sourcehttps://github.com/nvh95/jest-preview

What jest-preview is

A TypeScript-based dev tool that runs a local preview server and intercepts Jest test execution to render component output in a browser. Supports CSS transforms (direct import, CSS Modules, Sass, styled-components, Emotion), works framework-agnostic with React, Vue, Svelte, Angular, and Next.js.

Quickstart

Get the jest-preview source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/nvh95/jest-preview.gitcd jest-preview# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Component-driven test debugging

Visually debug complex component rendering and layout issues during Jest test development without manually reading HTML output or console logs.

CSS and styling verification

Quickly validate that CSS, CSS-in-JS (styled-components, Emotion), and CSS Modules are applied correctly to components in test context.

Multi-framework test development

Streamline test writing across React, Vue, Svelte, Angular, and Next.js projects with consistent browser-based visual feedback.

Implementation considerations

  • Requires Jest Preview CLI server to run in parallel with tests; plan for additional terminal/process management during development.
  • CSS transformation configuration is necessary; pre-configured transforms exist but may need customization for uncommon CSS-in-JS libraries or loaders.
  • Test code must explicitly call `preview.debug()` or `debug()` to trigger browser preview; not automatic—requires test code modification.
  • Browser auto-reload on `preview.debug()` call depends on stable server connection; network or port conflicts may affect reliability.
  • Performance may degrade with very large or deeply nested component trees; monitor browser responsiveness when debugging complex UIs.

When to avoid it — and what to weigh

  • Server-side rendering or Node.js-only logic — Jest Preview focuses on front-end component visualization; it is not designed for testing server logic or non-UI code paths.
  • Headless CI/CD environments without manual review — The tool requires interactive browser access during development; it cannot replace automated visual regression testing in headless pipelines.
  • Projects with minimal CSS or styling complexity — If tests are already passing and styling is simple, the overhead of running a preview server may not justify the value gained.
  • Teams without TypeScript or modern bundler knowledge — Setup requires familiarity with Jest configuration, CSS transformers, and sometimes custom webpack/Vite setup; not suitable for low-complexity projects.

License & commercial use

Licensed under MIT (MIT License), a permissive open-source license that allows commercial and private use, modification, and distribution with minimal restrictions.

MIT license permits commercial use without warranty or liability. Developers may use jest-preview freely in commercial projects. No proprietary restrictions or commercial licensing model apparent from provided data. Confirm any dependency licenses if bundling with other tools.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Jest Preview runs a local development server for browser preview; ensure port is not exposed to untrusted networks. No explicit security audit data provided. As a dev-only tool not involved in production runtime, attack surface is limited to development environment. Review dependencies for vulnerabilities using standard npm tools.

Alternatives to consider

Vitest Preview

Drop-in alternative for Vitest-based projects; similar visual debugging approach but optimized for Vitest ecosystem instead of Jest.

Playwright Inspector / Cypress UI

Full browser automation frameworks with integrated debuggers; more heavyweight but offer end-to-end testing and advanced debugging; overkill for unit test visualization.

React DevTools / Vue DevTools

Browser extensions for component inspection; lightweight but lack integrated test execution view; useful as complementary tool, not replacement.

Software development agency

Build on jest-preview with DEV.co software developers

Start using Jest Preview to debug component tests visually in seconds. No complex setup required—just install, configure CSS transforms, and add one line of code to your tests.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

jest-preview FAQ

Do I need to modify all my tests to use jest-preview?
No. You only add `preview.debug()` calls to tests where you want visual debugging. Existing tests run unchanged. The preview server runs independently and only displays output when explicitly invoked.
Can jest-preview work with my custom CSS-in-JS library?
Possibly. Built-in support exists for styled-components and Emotion. For others, you may need to configure custom code transformations in Jest. Check the Advanced Configuration guide on jest-preview.com for details.
Is jest-preview suitable for CI/CD pipelines?
No. Jest Preview is a development-only interactive tool requiring browser access. It cannot run headless or generate automated visual regression reports. Use it locally; rely on separate tools like Percy or Chromatic for CI visual testing.
What frameworks does jest-preview support?
React, Next.js, Vue, Svelte, and Angular are documented with examples. The package is framework-agnostic, so others may work; refer to official docs or community examples for your specific framework.

Custom software development services

Need help beyond evaluating jest-preview? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source testing integrations — and maintain them long-term.

Speed up your Jest test development

Start using Jest Preview to debug component tests visually in seconds. No complex setup required—just install, configure CSS transforms, and add one line of code to your tests.