{"name":"testdom","version":"1.0.0","description":"Testdom helps you write tests for the browser & node","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha -R nyan -w --check-leaks"},"repository":{"type":"git","url":"https://github.com/asbjornenge/testdom.git"},"keywords":["dom","test","testing"],"author":{"name":"Asbjorn Enge","email":"asbjorn@hanafjedle.net"},"license":"BSD","bugs":{"url":"https://github.com/asbjornenge/testdom/issues"},"homepage":"https://github.com/asbjornenge/testdom","dependencies":{"jsdom":"^2.0.0"},"devDependencies":{"localStorage":"^1.0.3"},"gitHead":"32c2d9735a64ef72994d066d87c72d7f1d4e1655","_id":"testdom@1.0.0","_shasum":"06fac3ad1481e4d5a44b140024a76248090e2b16","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"},"maintainers":[{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"}],"dist":{"shasum":"06fac3ad1481e4d5a44b140024a76248090e2b16","tarball":"http://registry-npm.ywwl.com/testdom/download/testdom-1.0.0.tgz","integrity":"sha512-OE3SnZknMEbTuPVKUPnAG+ERk8EgXjBxJSDsiCgoygPGILNcI4CWB7X46U/WruDAGUIH6q24e7HKokJRlGUxkQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsi15gjMtjj+eFIfecgGZnysib8/rqUu9YWARLAbC42gIgb1Ay8Z+fD8Phw408X/SIeJg8+gUhcEqKq9CWBYVrjOQ="}],"size":1940,"noattachment":false,"key":"/testdom/-/testdom-1.0.0.tgz"},"readme":"# Testdom\n\nTestdom is a [jsdom](https://github.com/tmpvar/jsdom) wrapper to help developers write test code that works both in the browser and in node.\n\nIt works by checking if a global document exists in it's current environment. If it does it bails out and expects the browser to provide all available browser globals. If a global document does not exists, it will create one using jsdom. \n\n**WANTED!** *PRs with more tested additional globals.*\n\n## Install\n\n    npm install testdom\n\n## Usage\n\n    require('testdom')('<html><body></body></html>')\n    console.log(document)\n\n## Additional globals\n\nTestdom supports an argument of *additional globals* that will be loaded (using require) only if no DOM exists. This way users can experiment with different modules as browser global replacements and polyfills.\n\n    require('testdom')('<html><body></body></html>', {\n        localStorage : 'localStorage',\n    })\n    console.log(localStorage)\n\nIn the *additional globals* object the **key** is the **name of the global** the the **value** is the **module** name to be require'd.\n\nSince v1.1.0 we also support **arbitrary globals**, so anything passed to *additional globals* that is not a string, we be added globally as is.\n\n### Confirmed modules\n\nA list of modules confirmed to work well as a global/polyfill for jsdom.\n\n| Global        | Module        | Notes |\n|:------------- |:------------- |:----- | \n| localStorage  | [localStorage](https://www.npmjs.com/package/localStorage) | 404 link but npm install works |\n| Promise  | [es6-promises](https://www.npmjs.com/package/es6-promises) | Different than `es6-promise` (singular). |\n\n\n## Testling\n\nTestling uses [browserify](http://browserify.org/) to create a browser compatible bundle of your javascripts. Unfortunately jsdom is not compatible with browserify, so we have to tell testling to ignore it.\n\nIn your <code>package.json</code> add a *browser* field and add tell browserify to ignore *jsdom*.\n\n    $ vi package.json\n    \n    ...\n    \"browser\" : {\n        \"jsdom\" : false\n    },\n    ...\n\nSince testdom only tries to require jsdom if no document exists; the browser will never reach that code and we are good. The tests will use the browser's DOM.\n\n## Changelog\n\n### 3.0.0\n\n* Upgraded `jsdom` to 13.0.0 -- requires node 8+\n\n### 2.0.0\n\n* Upgraded `jsdom` to 6.5.1 -- requires node 4+\n\n### 1.1.0\n\n* Support for arbitrary globals\n\n### 1.0.1\n\n* Upgraded jsdom dependency from 2.x.x to 3.x.x\n\n### 1.0.0\n\n* Removed non-jsdom dependencies (& globals)\n* Added ability to require non-jsdom modules only if DOM does not exists\n* Started list of working globals & polyfills\n\n### 0.1.0\n\n* Pre changelog era. Who knows what went on.\n\nenjoy.\n","publish_time":1421449377392,"_cnpm_publish_time":1421449377392,"dist-tags":{"latest":"3.0.1"}}