{"name":"testdom","version":"3.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":"git+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":"^13.0.0"},"devDependencies":{"localStorage":"^1.0.3","mocha":"^5.2.0"},"gitHead":"3997b12cd005911c51db75d37a7fdbe63aadd769","_id":"testdom@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.2","_npmUser":{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"},"dist":{"integrity":"sha512-KrX7TwTOMAz2m3ClHAnRfk+cS3NV3mNGEE7mA1D2wDNUv0nMvW97M4vnBIkLqRZQmgSQeuL1fRj1IcdUF2okRA==","shasum":"4c4dd614b9bf9f539f0f4c5267191f3886aa17fb","tarball":"http://registry-npm.ywwl.com/testdom/download/testdom-3.0.0.tgz","fileCount":4,"unpackedSize":5082,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcDm5yCRA9TVsSAnZWagAAlEsQAJjQj6cn74YrwRMYx8St\nsCZfYztYwuA/n08IIl+ycTyNWq9QA08monKU8qz/uJ4SKArkJMXX/ILQd9CA\nuC7H347qyOK3dzfUcHGKeaYgJguSCaGWa3q4hIzjE6dXeBLN7upQAV/NWopi\nY8iUg6w3NqJaLFrfzSE9v0PYcfBuBjv08xaXOUEDKXZmSpZmO2skBvRMwKBE\n2GawFMgS0avntSqBlH0hwyk8OWSaqE5VlqfTqtNyhSPTOTmLpaSXV1MhabFu\nzv/RzG3S2q9/HjQAoycA3KQEXJs3bKdAcpSFKclv4mfk1aTEUp3g47LjO/+m\n2rMwVoFAajOkx/dRHlYOrwlV1qRBXkdC6Yb4bunu6CaWP46Z15D/CL05K8Ga\nb3a6bO9EU3Oikenme/t1Xpj4D/syrbYpZEJVYJEZzlH/MpMP6VD3jZIr/ZuX\n7SARHYsEEgSnc99tE92PnYSh/Yl9GBICKL2NLJPraVCfK4o+ezwekEyzUeGR\nTUoVRTnXcTGZ04edW3kNvWZzbzSvS4ccC+w5IAUMbCTKEQcqk6Mkk0w/6enr\nvOp9MfpRz5NR/d4K8KwTOxGvMSYjuOr3lYeiuCaTcoPw3majUdcpFTp7uUbD\nJxp83nadvsdg8hFmj68ytZztfaYizGJBmnVHVKYpOySQEcbDQxI3Cui1djLs\nh117\r\n=yHRh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHTBUyNfSCJf1YlgH6fFeaW6caUPZ/DZr7QLR1tGCN3+AiABEfOyophRcaHrRrOuy24ouPIxkkYsfGiKSx40G1emJw=="}],"size":2207,"noattachment":false,"key":"/testdom/-/testdom-3.0.0.tgz"},"maintainers":[{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/testdom_3.0.0_1544449650233_0.4781334703443285"},"_hasShrinkwrap":false,"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":1544449650390,"_cnpm_publish_time":1544449650390,"dist-tags":{"latest":"3.0.1"}}