In a nutshell: Instead of trying to understand what jsdom's elements represents by inspecting their implementation objects like so: before.png

…let's just inspect them like they were real HTML elements: after.png

Typical use-case would be some script/test that utilizes jsdom in a Node.js environment, e.g. Jest.

How to use

npm install jsdom-devtools-formatter
// in some file.js
const jsdomDevtoolsFormatter = require('jsdom-devtools-formatter');

// You can also opt-out at some later point by:

E.g. for Jest it's probably easiest to integrate through setupTestFrameworkScriptFile configuration.

As a one-time thing also need to:

  • Open Chrome's Devtools
  • Click the "⠇" in the upper-right corner > Settings
  • Under "Console", check "Enable custom formatters"


The source code is all plain vanilla JS and standard CommonJS modules. Tests are written using Jest

See package.json's scripts sections for all available commands. The most useul ones are probably:

# run all tests once:
npm test

# run tests in "watch mode"
npm test -- --watch


In addition to verifying logical changes using the automated tests, it's recommended to verify that things "look & feel" as expected using the manual tests:

  • Open chrome://inspect and click the "Open dedicated DevTools for Node" link (one-time thing)
  • Then run one of the following commands
npm run test:manual_node
# -or-
npm run test:manual_jest

It should stop at the debugger call, from there you can follow the inlined comment with instructions to play with the console output.

Related resources