mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
lighthouse test tweaks
This commit is contained in:
parent
53305f90ba
commit
38a70910f3
@ -3,7 +3,7 @@ language: node_js
|
|||||||
node_js: node
|
node_js: node
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
chrome: stable
|
chrome: beta
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
@ -13,12 +13,6 @@ cache:
|
|||||||
install:
|
install:
|
||||||
- npm i
|
- 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:
|
script:
|
||||||
- npm test
|
- npm test
|
||||||
- npm run build
|
- npm run build
|
||||||
|
@ -8,14 +8,17 @@ const launchChromeAndRunLighthouse = (
|
|||||||
opts = { chromeFlags: ['--headless'] },
|
opts = { chromeFlags: ['--headless'] },
|
||||||
config = null
|
config = null
|
||||||
) =>
|
) =>
|
||||||
chromeLauncher.launch({ chromeFlags: opts.chromeFlags }).then(chrome => {
|
chromeLauncher
|
||||||
opts.port = chrome.port
|
.launch({ chromeFlags: opts.chromeFlags })
|
||||||
return lighthouse(url, opts, config).then(results =>
|
.then(async chrome => {
|
||||||
chrome.kill().then(() => results.lhr)
|
opts.port = chrome.port
|
||||||
)
|
const results = await lighthouse(url, opts, config)
|
||||||
})
|
await chrome.kill()
|
||||||
|
return results.lhr
|
||||||
|
})
|
||||||
|
|
||||||
let scores
|
let scores
|
||||||
|
|
||||||
test.before(async () => {
|
test.before(async () => {
|
||||||
console.log(`Auditing ${siteMetadata.siteUrl}.\n`) // eslint-disable-line no-console
|
console.log(`Auditing ${siteMetadata.siteUrl}.\n`) // eslint-disable-line no-console
|
||||||
scores = await launchChromeAndRunLighthouse(siteMetadata.siteUrl).then(
|
scores = await launchChromeAndRunLighthouse(siteMetadata.siteUrl).then(
|
||||||
|
Loading…
Reference in New Issue
Block a user