From a66480a416dee73dd4ac9d8ed8bfc4a51b5b637c Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Tue, 20 Jun 2017 17:32:08 -0700 Subject: [PATCH] Fix ESLint failures (#34) References #33 --- .travis.yml | 2 +- lib/Page.js | 14 ++------------ lib/helpers.js | 2 +- package.json | 4 ++-- test/test.js | 2 ++ 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b49387a..21b16050 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,5 @@ install: # puppeteer's install script downloads Chrome script: - yarn run lint - - yarn run test-puppeteer + - yarn run unit - yarn run test-phantom diff --git a/lib/Page.js b/lib/Page.js index 40abe375..daecd4f8 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -123,7 +123,7 @@ class Page extends EventEmitter { await this._client.send('Runtime.evaluate', { expression, returnByValue: true }); function inPageCallback(callbackName) { - window[callbackName] = async (...args) => { + window[callbackName] = async(...args) => { const me = window[callbackName]; let callbacks = me['callbacks']; if (!callbacks) { @@ -133,6 +133,7 @@ class Page extends EventEmitter { const seq = (me['lastSeq'] || 0) + 1; me['lastSeq'] = seq; const promise = new Promise(fulfill => callbacks.set(seq, fulfill)); + // eslint-disable-next-line no-console console.debug('driver:InPageCallback', JSON.stringify({name: callbackName, seq, args})); return promise; }; @@ -523,17 +524,6 @@ class Page extends EventEmitter { } } -class InPageCallback { - /** - * @param {string} name - * @param {function(?):?} callback - */ - constructor(name, callback) { - this.name = name; - this.callback = callback; - } -} - /** @enum {string} */ Page.PaperFormats = { Letter: {width: 8.5, height: 11}, diff --git a/lib/helpers.js b/lib/helpers.js index ddd764db..af0ab1c7 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -14,7 +14,7 @@ * limitations under the License. */ -var helpers = module.exports = { +module.exports = { /** * @param {function()} fun diff --git a/package.json b/package.json index f1a2f38a..50977c27 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "node": ">=7.10.0" }, "scripts": { - "test-puppeteer": "jasmine test/test.js", + "unit": "jasmine test/test.js", "test-phantom": "python third_party/phantomjs/test/run-tests.py", - "test": "npm run lint --silent && npm run test-puppeteer && npm run test-phantom", + "test": "npm run lint --silent && npm run unit && npm run test-phantom", "install": "node install.js", "lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint ." }, diff --git a/test/test.js b/test/test.js index 76063c26..9e39a037 100644 --- a/test/test.js +++ b/test/test.js @@ -30,6 +30,8 @@ var GOLDEN_DIR = path.join(__dirname, 'golden'); var OUTPUT_DIR = path.join(__dirname, 'output'); var PROJECT_DIR = path.join(__dirname, '..'); +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10 * 1000; + describe('Puppeteer', function() { var browser; var staticServer;