If you're running your tests in the browser bundled with webpack (or similar)
DOM Testing Library should work out of the box for you. However, most
DOM Testing Library are using it with
the Jest testing framework with the
(which is the default configuration with Jest).
Using Without Jest
First, install jsdom and jsdom-global.
npm install --save-dev jsdom jsdom-global
With mocha, the test command would look something like this:
mocha --require jsdom-global/register
Note, depending on the version of Node you're running, you may also need to install
@babel/polyfill(if you're using babel 7) or
babel-polyfill(for babel 6).