doc: fix code examples in CONTRIBUTING.md (#402)

* fix `ReferenceError: Invalid left-hand side in assignment` errors

* add variable declarations

* unify spacing with examples in the README.md
This commit is contained in:
Vse Mozhet Byt 2017-08-20 03:33:26 +03:00 committed by Eric Bidelman
parent 970e9c4b35
commit 8c245eef4e

View File

@ -86,7 +86,7 @@ npm run unit -- --filter=waitFor
... ...
// Using "fit" to run specific test // Using "fit" to run specific test
fit('should work', SX(async function() { fit('should work', SX(async function() {
await response = page.goto(EMPTY_PAGE); const response = await page.goto(EMPTY_PAGE);
expect(response.ok).toBe(true); expect(response.ok).toBe(true);
})) }))
``` ```
@ -95,7 +95,7 @@ npm run unit -- --filter=waitFor
... ...
// Using "xit" to skip specific test // Using "xit" to skip specific test
xit('should work', SX(async function() { xit('should work', SX(async function() {
await response = page.goto(EMPTY_PAGE); const response = await page.goto(EMPTY_PAGE);
expect(response.ok).toBe(true); expect(response.ok).toBe(true);
})) }))
``` ```
@ -135,13 +135,11 @@ Puppeteer uses [DEBUG](https://github.com/visionmedia/debug) module to expose so
```js ```js
const puppeteer = require('puppeteer'); const puppeteer = require('puppeteer');
(async() => { (async () => {
const browser = await puppeteer.launch();
const browser = await puppeteer.launch(); const page = await browser.newPage();
const page = await browser.newPage(); await page.goto('https://example.com');
await page.goto('https://example.com'); browser.close();
browser.close();
})(); })();
``` ```