diff --git a/.travis.yml b/.travis.yml index ad7c2f8..f6efa4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: node_js node_js: node addons: - chrome: stable + chrome: beta cache: directories: @@ -13,12 +13,6 @@ cache: install: - npm i -before_script: - - export DISPLAY=:99.0 - - export CHROME_PATH="$(pwd)/chrome-linux/chrome" - - sh -e /etc/init.d/xvfb start - - sleep 3 # wait for xvfb to boot - script: - npm test - npm run build diff --git a/scripts/lighthouse.test.js b/scripts/lighthouse.test.js index 85c588c..7be262a 100644 --- a/scripts/lighthouse.test.js +++ b/scripts/lighthouse.test.js @@ -8,14 +8,17 @@ const launchChromeAndRunLighthouse = ( opts = { chromeFlags: ['--headless'] }, config = null ) => - chromeLauncher.launch({ chromeFlags: opts.chromeFlags }).then(chrome => { - opts.port = chrome.port - return lighthouse(url, opts, config).then(results => - chrome.kill().then(() => results.lhr) - ) - }) + chromeLauncher + .launch({ chromeFlags: opts.chromeFlags }) + .then(async chrome => { + opts.port = chrome.port + const results = await lighthouse(url, opts, config) + await chrome.kill() + return results.lhr + }) let scores + test.before(async () => { console.log(`Auditing ${siteMetadata.siteUrl}.\n`) // eslint-disable-line no-console scores = await launchChromeAndRunLighthouse(siteMetadata.siteUrl).then(