mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
lighthouse test tweaks
This commit is contained in:
parent
53305f90ba
commit
38a70910f3
@ -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
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user