A simple JSDom configuration for testing libraries.
The easiest way to get simple-jsdom is through npm.
npm i simple-jsdom
To modify the global namespace, run:
Most of the time that I use JSDom, I only want to make it so that my client side tests work in a Node environment without blowing up. I'm less interested in thinking about how JSDom works.
I found myself copying and pasting the same code between projects, so I abstracted into this bare bones JSDom configuration. Require this in and your tests should Just Work©.
For instance, you should be able to use most (all?) of the jQuery API after you've included this.
This library requires Node v4+ and JSDom v8+.
This module returns two things: a
globals object, which returns the globals created by JSDom,
install method, which attaches those things to the global namespace.
The four objects are: