tmpvar/jsdom — pull request #849 by lawnsea (2014-08-02 21:08:29+00:00)
Title: Browserify bundle

Add **experimental** support for running a browserified jsdom in a Web Worker and implement a browser test runner. Fixes #711.

# Testing

The tests can be run in two ways:
- via WebDriver by running `node test/browser-runner.js`
- in the browser by running an HTTP server in the repo root and loading http://localhost:8080/test (a blank page is expected: the results are written to the console)

# Caveats

The WebDriver tests run against Chrome only. Many tests do not pass. Some suites will crash the test runner. By default, the runner only runs those suites that pass (100%) in Chrome. However, other suites (except those that crash the runner) can be run with the `-s` option. The tests pass in Safari. 14 of the `level2/events` tests do not work in Firefox or IE11, but hey what does?

I have not thoroughly tested the myriad ways to bootstrap a DOM. I am almost certain that some will fail.

# Validation

- `npm test` should pass
- `node test/browser-runner.js` should produce
```
running level1/core level1/core
running level1/html level1/html
running level1/svg level1/svg
running level2/core level2/core
running level2/extra level2/extra
running level2/events level2/events
running level3/textContent.js level3/textContent
running window/index window/index
running jsdom/utils jsdom/utils

level1/core 535/535 100%
level1/html 236/236 100%
level1/svg 527/527 100%
level2/core 287/287 100%
level2/extra 4/4 100%
level2/events 24/24 100%
level3/textContent 1/1 100%
window/index 8/8 100%
jsdom/utils 11/11 100%
-------------------------------------------
TOTALS: 0/1633 failed; 100% success
```
- `node test/browser-runner.js -t textsplittexttwo` should produce
```
running level1/core level1/core
running level1/html level1/html
running level1/svg level1/svg

level1/core 2/2 100%
level1/html 1/1 100%
level1/svg 2/2 100%
--------------------------------
TOTALS: 0/5 failed; 100% success
```
- `node test/browser-runner.js -s core -t textsplittexttwo -v` should produce
```
running level1/core level1/core
hc_textsplittexttwo ... done
textsplittexttwo ... done

level1/core 2/2 100%
--------------------------------
TOTALS: 0/2 failed; 100% success
```
- `node test/browser-runner.js -s living-html/navigator` should produce
```
running living-html/navigator.js living-html/navigator
✖ living-html/navigator/cookieEnabled should be true on the navigator object
undefined undefined 'Error: \n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:63:58\n at Array.forEach (native)\n at EventEmitter.runnerHandlers.testDone (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:48:18)\n at EventEmitter.emit (events.js:98:17)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:76:26\n at Array.forEach (native)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:72:20\n at _fulfilled (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:787:54)\n at self.promiseDispatch.done (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:816:30)\n at Promise.promise.promiseDispatch (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:749:13)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:557:44\n at flush (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:108:17)\n at process._tickCallback (node.js:415:13)\n'
✖ living-html/navigator/navigator properties should be read-only from the site
undefined undefined 'Error: \n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:63:58\n at Array.forEach (native)\n at EventEmitter.runnerHandlers.testDone (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:48:18)\n at EventEmitter.emit (events.js:98:17)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:76:26\n at Array.forEach (native)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:72:20\n at _fulfilled (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:787:54)\n at self.promiseDispatch.done (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:816:30)\n at Promise.promise.promiseDispatch (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:749:13)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:557:44\n at flush (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:108:17)\n at process._tickCallback (node.js:415:13)\n'
undefined undefined 'Error: \n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:63:58\n at Array.forEach (native)\n at EventEmitter.runnerHandlers.testDone (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/runner-display.js:48:18)\n at EventEmitter.emit (events.js:98:17)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:76:26\n at Array.forEach (native)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/test/browser-runner.js:72:20\n at _fulfilled (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:787:54)\n at self.promiseDispatch.done (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:816:30)\n at Promise.promise.promiseDispatch (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:749:13)\n at /Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:557:44\n at flush (/Users/lon.ingram/Dropbox/src/treehousejs/jsdom/node_modules/q/q.js:108:17)\n at process._tickCallback (node.js:415:13)\n'

living-html/navigator 0/2 0%
----------------------------------------
TOTALS: 2/2 failed; 0% success
```