{"name":"jsdom-global","version":"2.0.0","description":"Enable DOM in Node.js","main":"index.js","browser":"browser.js","scripts":{"test":"node test.js && standard"},"repository":{"type":"git","url":"git+https://github.com/rstacruz/jsdom-global.git"},"keywords":["jsdom","dom","test"],"author":{"name":"Rico Sta. Cruz","email":"rico@ricostacruz.com"},"license":"MIT","bugs":{"url":"https://github.com/rstacruz/jsdom-global/issues"},"homepage":"https://github.com/rstacruz/jsdom-global#readme","devDependencies":{"jsdom":"9.0.0","standard":"7.0.1","tape":"4.4.0"},"gitHead":"4482bc95bef2f31647135ade546ed98dec8e3f9e","_id":"jsdom-global@2.0.0","_shasum":"ef7451defd3d1d5f37bc3e04b94821e47c6a50cb","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.0","_npmUser":{"name":"rstacruz","email":"dropbox@ricostacruz.com"},"dist":{"shasum":"ef7451defd3d1d5f37bc3e04b94821e47c6a50cb","tarball":"http://registry-npm.ywwl.com/jsdom-global/download/jsdom-global-2.0.0.tgz","integrity":"sha512-pw0dbsj80OOO5UkkkrpU97oFeZ5S49Cw0P4BFCwwzbTe9qhDqrrwMAazV0x3H3970KMn6SueuLnmo+POSTL97w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBrgdtM4rIel5evdMwUyDBcpFlZXHwR0soJMU02AAKKrAiBTSQ3Q1nb+tvUDTAq9qgmQY34m22k3B/3MGK/wpxh4gQ=="}],"size":3440,"noattachment":false,"key":"/jsdom-global/-/jsdom-global-2.0.0.tgz"},"maintainers":[{"name":"rstacruz","email":"dropbox@ricostacruz.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/jsdom-global-2.0.0.tgz_1463151086172_0.7895948658697307"},"directories":{},"readme":"# jsdom-global\n\n> Enables DOM in Node.js\n\njsdom-global will inject `document`, `window` and other DOM API into your Node.js environment. Useful for running, in Node.js, tests that are made for browsers.\n\n[![Status](https://travis-ci.org/rstacruz/jsdom-global.svg?branch=master)](https://travis-ci.org/rstacruz/jsdom-global \"See test builds\")\n\n## Install\n\nRequires [jsdom][].\n\n```\nnpm install --save-dev --save-exact jsdom jsdom-global\n```\n\n[jsdom]: https://github.com/tmpvar/jsdom\n\n## Note\n\njsdom-global now requires jsdom v10 or above. If you need jsdom v9 and below, use the previous version (`jsdom-global@2`).\n\n## Usage\n\nJust invoke it to turn your Node.js environment into a DOM environment.\n\n```js\nrequire('jsdom-global')()\n\n// you can now use the DOM\ndocument.body.innerHTML = 'hello'\n```\n\nYou may also pass parameters to jsdomGlobal() like so: `require('jsdom-global')(html, options)`.\nCheck the [jsdom.jsdom()][] documentation for valid values for the `options` parameter.\n\nTo clean up after itself, just invoke the function it returns.\n\n```js\nvar cleanup = require('jsdom-global')()\n\n// do things\n\ncleanup()\n```\n\n## Tape\n\nIn [tape][], run it before your other tests.\n\n```js\nrequire('jsdom-global')()\n\ntest('your tests', (t) => {\n  /* and so on... */\n})\n```\n\n## Mocha\n\n__Simple:__ Use Mocha's `--require` option. Add this to the `test/mocha.opts` file (create it if it doesn't exist)\n\n```\n-r jsdom-global/register\n```\n\n__Advanced:__ For finer control, you can instead add it via [mocha]'s `before` and `after` hooks.\n\n```js\nbefore(function () {\n  this.jsdom = require('jsdom-global')()\n})\n\nafter(function () {\n  this.jsdom()\n})\n```\n\n[tape]: https://github.com/substack/tape\n[mocha]: https://mochajs.org/\n[jsdom.jsdom()]: https://github.com/tmpvar/jsdom/#for-the-hardcore-jsdomjsdom\n\n## ES2015\n\nIf you prefer to use `import` rather than `require`, you might want to use `jsdom-global/register` instead. Place it on top of your other import calls.\n\n```js\nimport 'jsdom-global/register'\nimport React from 'react'\nimport jQuery from 'jquery'\n// ...\n```\n\n## Browserify\n\nIf you use [Browserify] on your tests (eg: [smokestack], [tape-run], [budo], [hihat], [zuul], and so on), doing `require('jsdom-global')()` is a noop. In practice, this means you can use jsdom-global even if your tests are powered by browserify, and your test will now work in both the browser and Node.\n\n[zuul]: https://www.npmjs.com/package/zuul\n[tape-run]: https://www.npmjs.com/package/tape-run\n[budo]: https://github.com/mattdesl/budo\n[hihat]: https://www.npmjs.com/package/hihat\n[smokestack]: https://www.npmjs.com/package/smokestack\n\n* Writing your tests (`test.js`):\n\n  ```js\n  require('jsdom-global')()\n\n  // ...do your tests here\n  ```\n\n* Running it with [smokestack]:\n\n  ```sh\n  browserify test.js | smokestack          # run in a browser\n  node test.js                             # or the console\n  browserify test.js --no-bundle-external  # also works (but why bother?)\n  ```\n\n* Running it with Babel ([babelify] or [babel-cli]):\n\n  ```sh\n  browserify test.js -t babelify | smokestack  # run in a browser (with babel)\n  babel-node test.js                           # or the console\n  ```\n\n[Browserify]: http://browserify.org/\n[babel-cli]: https://babeljs.io/docs/usage/cli/\n[babelify]: https://github.com/babel/babelify\n\n## Thanks\n\n**jsdom-global** © 2016+, Rico Sta. Cruz. Released under the [MIT] License.<br>\nAuthored and maintained by Rico Sta. Cruz with help from contributors ([list][contributors]).\n\n> [ricostacruz.com](http://ricostacruz.com) &nbsp;&middot;&nbsp;\n> GitHub [@rstacruz](https://github.com/rstacruz) &nbsp;&middot;&nbsp;\n> Twitter [@rstacruz](https://twitter.com/rstacruz)\n\n[MIT]: http://mit-license.org/\n[contributors]: http://github.com/rstacruz/jsdom-global/contributors\n","publish_time":1463151089525,"_cnpm_publish_time":1463151089525,"dist-tags":{"latest":"3.0.2"}}