jest-environment-puppeteer
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -5,2 +5,20 @@ # Change Log | ||
<a name="1.0.0"></a> | ||
# [1.0.0](https://github.com/smooth-code/jest-environment-puppeteer/compare/v0.2.0...v1.0.0) (2018-03-03) | ||
### feta | ||
* simplify API ([94c10e5](https://github.com/smooth-code/jest-environment-puppeteer/commit/94c10e5)) | ||
### BREAKING CHANGES | ||
* - `mainPage` is renamed into `page` | ||
- "/globalSetup" => "/setup" | ||
- "/globalTeardown" => "/teardown" | ||
- "/testEnvironment" => "" | ||
<a name="0.2.0"></a> | ||
@@ -7,0 +25,0 @@ # [0.2.0](https://github.com/smooth-code/jest-environment-puppeteer/compare/v0.1.0...v0.2.0) (2018-03-03) |
module.exports = require('./lib/PuppeteerEnvironment').default | ||
module.exports.globalSetup = require('./lib/global').setup | ||
module.exports.globalTeardown = require('./lib/global').teardown | ||
module.exports.setup = require('./lib/global').setup | ||
module.exports.teardown = require('./lib/global').teardown |
@@ -34,9 +34,9 @@ 'use strict'; | ||
}); | ||
this.global.mainPage = await this.global.browser.newPage(); | ||
this.global.mainPage.addListener('pageerror', handleError); | ||
this.global.page = await this.global.browser.newPage(); | ||
this.global.page.addListener('pageerror', handleError); | ||
} | ||
async teardown() { | ||
this.global.mainPage.removeListener('pageerror', handleError); | ||
await this.global.mainPage.close(); | ||
this.global.page.removeListener('pageerror', handleError); | ||
await this.global.page.close(); | ||
} | ||
@@ -43,0 +43,0 @@ } |
{ | ||
"name": "jest-environment-puppeteer", | ||
"description": "Run your tests using Jest & Puppeteer.", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
@@ -19,3 +19,3 @@ "repository": "git@github.com:smooth-code/jest-environment-puppeteer.git", | ||
"build": "rm -rf lib/ && babel src -d lib", | ||
"ci": "yarn build && yarn lint && yarn test", | ||
"ci": "yarn build && yarn lint && yarn test --ci", | ||
"dev": "babel src -d lib --watch", | ||
@@ -22,0 +22,0 @@ "format": "prettier --write \"src/**/*.js\" \"*.md\" \"*.js\"", |
@@ -19,5 +19,5 @@ # jest-environment-puppeteer | ||
{ | ||
"globalSetup": "jest-environment-puppeteer/globalSetup", | ||
"globalTeardown": "jest-environment-puppeteer/globalTeardown", | ||
"testEnvironment": "jest-environment-puppeteer/testEnvironment" | ||
"globalSetup": "jest-environment-puppeteer/setup", | ||
"globalTeardown": "jest-environment-puppeteer/teardown", | ||
"testEnvironment": "jest-environment-puppeteer" | ||
} | ||
@@ -61,2 +61,19 @@ ``` | ||
### Configure ESLint | ||
Jest Environment Puppeteer exposes two new globals: `browser` and `page`. If you want to avoid errors, you can add them to your `.eslintrc.js`: | ||
```js | ||
// .eslintrc.js | ||
module.exports = { | ||
env: { | ||
jest: true, | ||
}, | ||
globals: { | ||
page: true, | ||
browser: true, | ||
}, | ||
} | ||
``` | ||
### Extend PuppeteerEnvironment | ||
@@ -89,6 +106,9 @@ | ||
```js | ||
import { globalSetup, globalTeardown } from 'jest-environment-puppeteer' | ||
const { | ||
setup: setupPuppeteer, | ||
teardown: teardownPuppeteer, | ||
} = require('jest-environment-puppeteer') | ||
async function setup() { | ||
await globalSetup() | ||
await setupPuppeteer() | ||
// ... | ||
@@ -99,3 +119,3 @@ } | ||
// ... | ||
await globalTeardown() | ||
await teardownPuppeteer() | ||
} | ||
@@ -117,3 +137,3 @@ ``` | ||
### `global.mainPage` | ||
### `global.page` | ||
@@ -120,0 +140,0 @@ Give access to a [Puppeteer Page](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) opened at start (you will use it most of time). |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11471
1
157
11
93