{"name":"testdom","version":"0.1.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":"^0.11.1","localStorage":"^1.0.2"},"gitHead":"9466efb3f4c010816b0d5fe95fefafb500737f3c","_id":"testdom@0.1.0","_shasum":"6e35d331875b248a937f217216f4f8f177cb51bf","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"},"maintainers":[{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"}],"dist":{"shasum":"6e35d331875b248a937f217216f4f8f177cb51bf","tarball":"http://registry-npm.ywwl.com/testdom/download/testdom-0.1.0.tgz","integrity":"sha512-gBP5/wMd91Fi8f9Vn99FFykZk7NumxyWkfmEx4DPJgkJrqIzSip+JT4QX+wF6nxTUgSy1rBXE2lQJ07wn9R9zg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzeiuN40Nqn3KeJkK4eALagKfW+/+3Cot/7gdWA8XWlAIgNjqhnsl3es2kUh7xK5n44L4LxOyXdwiW1W87HGLF4sg="}],"size":1507,"noattachment":false,"key":"/testdom/-/testdom-0.1.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":1405944278646,"_cnpm_publish_time":1405944278646,"dist-tags":{"latest":"3.0.1"}}