From 8c245eef4e841893971d49ddb952b5ddbe5e3c4d Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 20 Aug 2017 03:33:26 +0300 Subject: [PATCH] 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 --- CONTRIBUTING.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6fe7c61aa1..e49eaad72f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ npm run unit -- --filter=waitFor ... // Using "fit" to run specific test fit('should work', SX(async function() { - await response = page.goto(EMPTY_PAGE); + const response = await page.goto(EMPTY_PAGE); expect(response.ok).toBe(true); })) ``` @@ -95,7 +95,7 @@ npm run unit -- --filter=waitFor ... // Using "xit" to skip specific test xit('should work', SX(async function() { - await response = page.goto(EMPTY_PAGE); + const response = await page.goto(EMPTY_PAGE); expect(response.ok).toBe(true); })) ``` @@ -135,13 +135,11 @@ Puppeteer uses [DEBUG](https://github.com/visionmedia/debug) module to expose so ```js const puppeteer = require('puppeteer'); -(async() => { - -const browser = await puppeteer.launch(); -const page = await browser.newPage(); -await page.goto('https://example.com'); -browser.close(); - +(async () => { + const browser = await puppeteer.launch(); + const page = await browser.newPage(); + await page.goto('https://example.com'); + browser.close(); })(); ```