jest-environment-puppeteer
Advanced tools
Comparing version 3.8.0 to 3.9.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [3.9.0](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/compare/v3.8.0...v3.9.0) (2019-01-22) | ||
### Bug Fixes | ||
* jest --watch fails to reload ([#182](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/issues/182)) ([cc9bbfa](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/commit/cc9bbfa)) | ||
* wrong timeout when using jestPuppeteer.debug() ([#185](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/issues/185)) ([0f4c720](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/commit/0f4c720)) | ||
### Features | ||
* add jestPuppeteer.resetPage ([#183](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/issues/183)) ([3a5526c](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/commit/3a5526c)) | ||
# [3.8.0](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer/compare/v3.7.0...v3.8.0) (2019-01-11) | ||
@@ -8,0 +25,0 @@ |
@@ -20,3 +20,3 @@ "use strict"; | ||
async function setup() { | ||
async function setup(jestConfig) { | ||
const config = await (0, _readConfig.default)(); | ||
@@ -31,2 +31,3 @@ | ||
process.env.PUPPETEER_WS_ENDPOINT = browser.wsEndpoint(); | ||
if (jestConfig.watch || jestConfig.watchAll) return; | ||
@@ -56,11 +57,13 @@ if (config.server) { | ||
async function teardown() { | ||
await (0, _jestDevServer.teardown)(); | ||
const config = await (0, _readConfig.default)(); | ||
async function teardown(jestConfig) { | ||
if (!jestConfig.watch && !jestConfig.watchAll) { | ||
await (0, _jestDevServer.teardown)(); | ||
const config = await (0, _readConfig.default)(); | ||
if (config.connect) { | ||
await browser.disconnect(); | ||
} else { | ||
await browser.close(); | ||
if (config.connect) { | ||
await browser.disconnect(); | ||
} else { | ||
await browser.close(); | ||
} | ||
} | ||
} |
@@ -66,8 +66,2 @@ "use strict"; | ||
this.global.page = await this.global.context.newPage(); | ||
if (config && config.exitOnPageError) { | ||
this.global.page.addListener('pageerror', handleError); | ||
} | ||
this.global.jestPuppeteer = { | ||
@@ -77,3 +71,3 @@ debug: async () => { | ||
// Set timeout to 4 days | ||
this.setTimeout(345600); // Run a debugger (in case Puppeteer has been launched with `{ devtools: true }`) | ||
this.setTimeout(345600000); // Run a debugger (in case Puppeteer has been launched with `{ devtools: true }`) | ||
@@ -115,4 +109,17 @@ await this.global.page.evaluate(() => { | ||
}); | ||
}, | ||
resetPage: async () => { | ||
if (this.global.page) { | ||
this.global.page.removeListener('pageerror', handleError); | ||
await this.global.page.close(); | ||
} | ||
this.global.page = await this.global.context.newPage(); | ||
if (config && config.exitOnPageError) { | ||
this.global.page.addListener('pageerror', handleError); | ||
} | ||
} | ||
}; | ||
await this.global.jestPuppeteer.resetPage(); | ||
} | ||
@@ -119,0 +126,0 @@ |
{ | ||
"name": "jest-environment-puppeteer", | ||
"description": "Puppeteer environment for Jest.", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"main": "index.js", | ||
@@ -29,6 +29,6 @@ "repository": "https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer", | ||
"cwd": "^0.10.0", | ||
"jest-dev-server": "^3.7.0", | ||
"jest-dev-server": "^3.9.0", | ||
"merge-deep": "^3.0.2" | ||
}, | ||
"gitHead": "d2355a17ca878928b17fd9a63fb547261d9fbeef" | ||
"gitHead": "556df3070570e097706e95adacdf326101a88c52" | ||
} |
@@ -80,2 +80,12 @@ # jest-environment-puppeteer | ||
### `global.jestPuppeteer.resetPage()` | ||
Reset global.page | ||
```js | ||
beforeEach(async () => { | ||
await jestPuppeteer.resetPage() | ||
}) | ||
``` | ||
### `jest-puppeteer.config.js` | ||
@@ -120,3 +130,3 @@ | ||
async function getConfig () { | ||
async function getConfig() { | ||
const response = await fetch(`${dockerHost}/json/version`) | ||
@@ -126,3 +136,3 @@ const browserWSEndpoint = (await response.json()).webSocketDebuggerUrl | ||
connect: { | ||
browserWSEndpoint | ||
browserWSEndpoint, | ||
}, | ||
@@ -134,3 +144,3 @@ server: { | ||
debug: true, | ||
} | ||
}, | ||
} | ||
@@ -137,0 +147,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27139
200
162
Updatedjest-dev-server@^3.9.0