{"_id":"@afternun/jest-dev-server","name":"@afternun/jest-dev-server","dist-tags":{"latest":"7.0.0-alpha"},"versions":{"7.0.0-alpha":{"name":"@afternun/jest-dev-server","description":"Fork to fix issue with wait-on","version":"7.0.0-alpha","main":"index.js","repository":{"type":"git","url":"https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-dev-server"},"author":{"name":"Greg Bergé","email":"berge.greg@gmail.com"},"license":"MIT","keywords":["jest","jest-environment","server"],"scripts":{"prebuild":"rimraf lib/","build":"babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src","dev":"yarn build --watch","prepublishOnly":"yarn build"},"dependencies":{"chalk":"^4.1.2","cwd":"^0.10.0","find-process":"^1.4.7","prompts":"^2.4.2","spawnd":"^6.0.2","tree-kill":"^1.2.2","wait-port":"^1.0.4"},"licenseText":"Copyright 2018 Smooth Code\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@afternun/jest-dev-server@7.0.0-alpha","dist":{"shasum":"503ed01064ae32b309448a4a52ff2b470acf6a35","integrity":"sha512-95yuP941BQV0tagUnsx5c8YrUdCXcyNmugeuwX3itbazp65jEsVB275ldDc7eEPhlpF8ABhZZx3UcnmbbxwRXQ==","tarball":"https://registry.npmjs.org/@afternun/jest-dev-server/-/jest-dev-server-7.0.0-alpha.tgz","fileCount":8,"unpackedSize":24485,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1/GPmDdNzzOAEcav+XAF8KUyXuluSQmBnN1/utrZHQgIhAITWp76lbg6unjPkOK4fmImdVlCdA2gc6EFjUu5x08gx"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjd2SEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5kw/9FOAQ6TF4/UfmYoiWMND/jb+Goiid5bxPnYLhuGtz+I3oV19p\r\nhgO6AhU3OGVAFW+VJ1LHzop5Wvgd17dFei1iO6lqh73wWbfK+1ucrFALKMXJ\r\nIZdtdza8mISJDb9cFKSEwG8tOUlAv0fQtgt89IKLjtwcGaMnMDPvZJ25BsJs\r\nfRtZV+NwVgRZfXLD7p7L3zXw5O7pTZNmqwbY/HM95ZmqW66YNrBFk0IUqgB5\r\nxE2MrjP7CqjaDE5GzXpdCO5VeVYK5W7XI+h/pdYZx4HUpINDvtP1MoFhrC+2\r\nycqcSYmX/k7zHSKRsEQxx7brPlDB6uUu5FPhVkVSwebvCUA08HRSINMrm8bL\r\nqjkQU65s/YDV9azLYSTNOGp8KiKR3a7IXAZD6dFxz/KApy0XOTx2WuzFYARf\r\nFdTV3jAbANrdox4xeN6lFNMUXfyjDMlfGrVvKTbXDSfFdPEPqex19Dod7UTN\r\n+iMAnXeD18faNtnJo7ZlsOlJOpgY504FWREH6OxtiaAC0flSrTyuz9q9leFq\r\nOWcS6lfqEyJizfL+r8/fhblbuopz7Yb8aHHqbkoFbIfe78hP+nPOl9DkjnlS\r\nXWPkr+y5trZ3GaT5S4bFkhmK4qCnD+bT6vlLiERiLyCwc/YBOfu4msR6TJl6\r\nbKIwSP/wosAuPk4HnffxD2sCQaoGEwZ1P7s=\r\n=uS2H\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"afternun","email":"michal.kacper.balos@gmail.com"},"directories":{},"maintainers":[{"name":"afternun","email":"michal.kacper.balos@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jest-dev-server_7.0.0-alpha_1668768900501_0.3090730918513158"},"_hasShrinkwrap":false}},"time":{"created":"2022-11-18T10:55:00.400Z","7.0.0-alpha":"2022-11-18T10:55:00.758Z","modified":"2022-11-18T10:55:00.913Z"},"maintainers":[{"name":"afternun","email":"michal.kacper.balos@gmail.com"}],"description":"Fork to fix issue with wait-on","keywords":["jest","jest-environment","server"],"repository":{"type":"git","url":"https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-dev-server"},"author":{"name":"Greg Bergé","email":"berge.greg@gmail.com"},"license":"MIT","readme":"# jest-dev-server\n\nStarts a server before your Jest tests and tears it down after.\n\n## Why\n\n`jest-puppeteer` works great for running tests in Jest using Puppeteer.\nIt's also useful for starting a local development server during the tests without letting Jest hang.\nThis package extracts just the local development server spawning without any ties to Puppeteer.\n\n## Install\n\n```bash\nnpm install --save-dev jest-dev-server\n```\n\n## Usage\n\n`jest-dev-server` exports `setup`,`teardown` and `getServers` functions.\n\n```js\n// global-setup.js\nconst { setup: setupDevServer } = require('jest-dev-server')\n\nmodule.exports = async function globalSetup() {\n  await setupDevServer({\n    command: `node config/start.js --port=3000`,\n    launchTimeout: 50000,\n    port: 3000,\n  })\n  // Your global setup\n}\n```\n\nIt is also possible to specify several servers:\n\n```js\n// global-setup.js\nconst { setup: setupDevServer } = require('jest-dev-server')\n\nmodule.exports = async function globalSetup() {\n  await setupDevServer([\n    {\n      command: 'node server.js',\n      port: 4444,\n    },\n    {\n      command: 'node server2.js',\n      port: 4445,\n    },\n  ])\n  // Your global setup\n}\n```\n\n```js\n// global-setup.js\nconst { setup: setupDevServer, getServers } = require('jest-dev-server')\n\nmodule.exports = async function globalSetup() {\n  await setupDevServer({\n    command: `node config/start.js --port=3000`,\n    launchTimeout: 50000,\n    port: 3000,\n  })\n  getServers.then((servers) => {\n    // You can get to the servers and do whatever you want\n  })\n  // Your global setup\n}\n```\n\n```js\n// global-teardown.js\nconst { teardown: teardownDevServer } = require('jest-dev-server')\n\nmodule.exports = async function globalTeardown() {\n  await teardownDevServer()\n  // Your global teardown\n}\n```\n\n## Options\n\n### `command`\n\nType: `string`, required.\n\nCommand to execute to start the port.\nDirectly passed to [`spawnd`](https://www.npmjs.com/package/spawnd).\n\n```js\nmodule.exports = {\n  command: 'npm run start',\n}\n```\n\n### `debug`\n\nType: `boolean`, default to `false`.\n\nLog server output, useful if server is crashing at start.\n\n```js\nmodule.exports = {\n  command: 'npm run start',\n  debug: true,\n}\n```\n\n### `launchTimeout`\n\nType: `number`, default to `5000`.\n\nHow many milliseconds to wait for the spawned server to be available before giving up.\nDefaults to [`wait-port`](https://www.npmjs.com/package/wait-port)'s default.\n\n```js\nmodule.exports = {\n  command: 'npm run start',\n  launchTimeout: 30000,\n}\n```\n\n---\n\nFollowing options are linked to [`spawnd`](https://www.npmjs.com/package/spawnd).\n\n### `host`\n\nType: `string`, default to `localhost`.\n\nHost to wait for activity on before considering the server running.\nMust be used in conjunction with `port`.\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  host: 'customhost.com',\n  port: 3000,\n}\n```\n\n### `path`\n\nType: `string`, default to `null`.\n\nPath to resource to wait for activity on before considering the server running.\nMust be used in conjunction with `host` and `port`.\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  host: 'customhost.com',\n  port: 3000,\n  path: 'thing',\n}\n```\n\n### `protocol`\n\nType: `string`, (`https`, `http`, `tcp`, `socket`) default to `tcp`.\n\nTo wait for an HTTP or TCP endpoint before considering the server running, include `http` or `tcp` as a protocol.\nMust be used in conjunction with `port`.\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  protocol: 'http',\n  port: 3000,\n}\n```\n\n### `port`\n\nType: `number`, default to `null`.\n\nPort to wait for activity on before considering the server running.\nIf not provided, the server is assumed to immediately be running.\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  port: 3000,\n}\n```\n\n### `usedPortAction`\n\nType: `string` (`ask`, `error`, `ignore`, `kill`) default to `ask`.\n\nIt defines the action to take if port is already used:\n\n- `ask`: a prompt is shown to decide if you want to kill the process or not\n- `error`: an errow is thrown\n- `ignore`: your test are executed, we assume that the server is already started\n- `kill`: the process is automatically killed without a prompt\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  port: 3000,\n  usedPortAction: 'kill',\n}\n```\n\n### `waitOnScheme`\n\n`jest-dev-server` use the [`wait-on`](https://www.npmjs.com/package/wait-on) npm package to wait for resources to become available before calling callback.\n\nType: `object`, default to `{}`.\n\n- `delay`: optional initial delay in ms, default 0\n- `interval`: optional poll resource interval in ms, default 250ms\n- `log`: optional flag which outputs to stdout, remaining resources waited on and when complete or errored\n- `reverse`: optional flag to reverse operation so checks are for resources being NOT available, default false\n- `timeout`: optional timeout in ms, default Infinity. Aborts with error\n- `tcpTimeout`: optional tcp timeout in ms, default 300ms\n- `verbose`: optional flag which outputs debug output, default false\n- `window`: optional stabilization time in ms, default 750ms. Waits this amount of time for file sizes to stabilize or other resource availability to remain unchanged\n\n**Note:** http(s) specific options, see https://github.com/request/request#readme for specific details\n\n```js\nmodule.exports = {\n  command: 'npm run start --port 3000',\n  port: 3000,\n  usedPortAction: 'kill',\n  waitOnScheme: {\n    delay: 1000,\n  },\n}\n```\n\n## Troubleshooting\n\n- If using `port` makes the terminal to ask for root password although the port is valid and accessible then use `usePortAction: 'ignore'`.\n\n## License\n\nMIT\n\n[build-badge]: https://img.shields.io/travis/smooth-code/jest-puppeteer.svg?style=flat-square\n[build]: https://travis-ci.org/smooth-code/jest-puppeteer\n[version-badge]: https://img.shields.io/npm/v/jest-dev-server.svg?style=flat-square\n[package]: https://www.npmjs.com/package/jest-dev-server\n[license-badge]: https://img.shields.io/npm/l/jest-dev-server.svg?style=flat-square\n[license]: https://github.com/smooth-code/jest-puppeteer/blob/master/LICENSE\n","readmeFilename":"README.md"}