About
Boilerplate I use to set up React.js components' testing harness under Node.js, based on the amazing jsdom.
Compatibility
The latest version depends on jsdom v6, which requires Node v4+. For a version compatible with Node
v0.10 and v0.12 please install ^3.0.0
.
Usage
$ npm install --save-dev jsdom-test-browser
Here's a sample Mocha test suite for a React component.
;
On jQueryify
As jsdom supports the modern browser DOM API, I'd advise against using jQueryify until it's absolutely necessary: say, when you rely on a jQuery plugin inside of a React component. Otherwise, querySelector, textContent, and friends work just fine.
Central bootstrap
With Gulp it would look something like that:
gulp; gulp;
Order of Node module imports
Please note that bro.newBrowser(callback)
should be called before React is
imported/required. That's because React probes its execution environment right away when is's
imported.