jest-dev-server
Advanced tools
Comparing version 8.0.2 to 8.0.3
{ | ||
"name": "jest-dev-server", | ||
"description": "Starts a server before your Jest tests and tears it down after.", | ||
"version": "8.0.2", | ||
"version": "8.0.3", | ||
"type": "commonjs", | ||
@@ -56,3 +56,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "a0672aac31827db7273a5eefd717401846589012" | ||
"gitHead": "6723a112283bb2da345bed8a5079ef8a0f19d6a9" | ||
} |
@@ -23,3 +23,3 @@ # jest-dev-server | ||
`jest-dev-server` exports `setup`,`teardown` and `getServers` functions. | ||
`jest-dev-server` exports `setup` and `teardown` functions. | ||
@@ -30,4 +30,4 @@ ```js | ||
module.exports = async function globalSetup() { | ||
await setupDevServer({ | ||
const options = async function globalSetup() { | ||
globalThis.servers = await setupDevServer({ | ||
command: `node config/start.js --port=3000`, | ||
@@ -41,4 +41,16 @@ launchTimeout: 50000, | ||
It is also possible to specify several servers: | ||
```js | ||
// global-teardown.js | ||
const { teardown: teardownDevServer } = require("jest-dev-server"); | ||
const options = async function globalTeardown() { | ||
await teardownDevServer(globalThis.servers); | ||
// Your global teardown | ||
}; | ||
``` | ||
### Specify several servers | ||
You can specify several servers using an array of configs: | ||
```js | ||
@@ -48,4 +60,4 @@ // global-setup.js | ||
module.exports = async function globalSetup() { | ||
await setupDevServer([ | ||
const options = async function globalSetup() { | ||
globalThis.servers = await setupDevServer([ | ||
{ | ||
@@ -64,29 +76,2 @@ command: "node server.js", | ||
```js | ||
// global-setup.js | ||
const { setup: setupDevServer, getServers } = require("jest-dev-server"); | ||
module.exports = async function globalSetup() { | ||
await setupDevServer({ | ||
command: `node config/start.js --port=3000`, | ||
launchTimeout: 50000, | ||
port: 3000, | ||
}); | ||
getServers.then((servers) => { | ||
// You can get to the servers and do whatever you want | ||
}); | ||
// Your global setup | ||
}; | ||
``` | ||
```js | ||
// global-teardown.js | ||
const { teardown: teardownDevServer } = require("jest-dev-server"); | ||
module.exports = async function globalTeardown() { | ||
await teardownDevServer(); | ||
// Your global teardown | ||
}; | ||
``` | ||
## Options | ||
@@ -102,3 +87,3 @@ | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start", | ||
@@ -115,3 +100,3 @@ }; | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start", | ||
@@ -130,3 +115,3 @@ debug: true, | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start", | ||
@@ -149,3 +134,3 @@ launchTimeout: 30000, | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -165,3 +150,3 @@ host: "customhost.com", | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -182,3 +167,3 @@ host: "customhost.com", | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -198,3 +183,3 @@ protocol: "http", | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -217,3 +202,3 @@ port: 3000, | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -243,3 +228,3 @@ port: 3000, | ||
```js | ||
module.exports = { | ||
const options = { | ||
command: "npm run start --port 3000", | ||
@@ -246,0 +231,0 @@ port: 3000, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
16972
228