This extension allows you to view the current state of your application during debug tests. It provides a WebView panel to render the DOM and an option to open it in a browser.
To properly render your application, you need to configure CSS handling in your test environment. If you're unsure how to do this, check out the ready-to-use template project with configured CSS support:
React Testing Library with CSS Template.
We recommend using the package @hheimerd/jest-transform-css
for CSS transformation in your tests. This package is a temporary fork of jest-transform-css
with added support for debugging. You can install it with:
pnpm add -D @hheimerd/jest-transform-css
- Start a debug session in Visual Studio Code.
- Run the command
DOM Renderer: Open in split view
from the Command Palette (Ctrl+Shift+P
orCmd+Shift+P
on macOS). - A WebView panel will open beside your editor, displaying the DOM structure.
- Run the command
DOM Renderer: Open in Browser
from the Command Palette. - Enter the port for the preview server (default is
6060
). - The DOM will open in your default browser.
To debug or inspect the WebView, you can open the Visual Studio Code Developer Tools:
- Go to the menu: Help > Toggle Developer Tools.
- In the Developer Tools window, navigate to the
Console
orElements
tab to inspect the WebView content.