{"name":"testdom","version":"3.0.1","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":"^20.0.0"},"devDependencies":{"localStorage":"^1.0.3","mocha":"^10.0.0"},"gitHead":"b0a63ed0093eb6a14608249d5c22add65070d12c","_id":"testdom@3.0.1","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-evsDE80tW9kTEzuTI+xRHTj1rgJFgcqzo6rZRLflGRNbZaQy8HrvVqwGrYOm2P9/aORWzUpyBu/PZ2kvH0qePQ==","shasum":"e6bbe2813921ad570ae0ebbe439e42922efea54a","tarball":"http://registry-npm.ywwl.com/testdom/download/testdom-3.0.1.tgz","fileCount":4,"unpackedSize":5083,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAP4GKV6zd7TaIhWg2iPcSvDOk6yb83+5d4PgfnJWRGIAiEA1V3HahzmGTm7NvKjvoO+vMv8UGChMmAxf1+f0HlJriw="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDF84ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWZQ//RKgGpLkKNABPvjZw/rXwFwPKb8MQ8Qy5Oo3Xi3008QHRZaFg\r\nSQzJbRPa4TiEufosfqwG3thC5t7QcZGxg8WjF68/TVuubONVcQmdsTFtj0CR\r\nY0IXwSIz/dz/r0FTHk3jewdh1lV8yopzuontY+GdXXVD4km0vxu8puaxbo62\r\nM8Mau7xPIi8J418agtwIBzzHWGWkfD6RsLZ9AmAQy9cXU94F3uJQLfqg/N2M\r\nz28MIZ0CD8LS4W1fMwAaboqCMlVTOMOClvybhYCUXU+NKbfTbMHT79wVtBEs\r\nqsonK8NGa9AMyWReNw12ztjFp1UFX/1DWZAyxOSvJwytnEk6RHeF60AE1gCY\r\n66Gh73ehvzM5TkhbyYeSm1qNUT/mwsM8tmkOM0GC97w1RrYX6IDc6ehj61O/\r\nskr4ZMVZtHKO7bTtjHLDNasumQViHMfkeMqIwFSSW9HmST0VAWOtOjh8+lS1\r\nyJ6FAZp5/qrFaT/d8U1R8BIgkWCts5UJ3M8V6Imn1FHLSPhNHI1683OynFnG\r\n3n720bdwJCOUPYRnSp3yjX9cM49Zvu3cTYmJQoblxcIgbKNL5LhFTUGsAdoR\r\nXg+KrBxtkoFfkuFOXftGbNO/xqCps5tAIcynWviKDsvUNOac8Xe5kMaxnWRj\r\n0mNn2+DFoI8HPTxc/9elSeJGsFFfYeRoFhs=\r\n=PzPs\r\n-----END PGP SIGNATURE-----\r\n","size":2185,"noattachment":false,"key":"/testdom/-/testdom-3.0.1.tgz"},"_npmUser":{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"},"maintainers":[{"name":"asbjornenge","email":"asbjorn@asbjornenge.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/testdom_3.0.1_1661755192085_0.9439963666538593"},"_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":1661755192237,"_cnpm_publish_time":1661755192237,"dist-tags":{"latest":"3.0.1"}}