mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
remove CI lighthouse test
This commit is contained in:
parent
e112e0c8b7
commit
cd01e70008
@ -38,7 +38,7 @@ The whole [portfolio](https://matthiaskretschmann.com) is a React-based Single P
|
|||||||
|
|
||||||
### ⛵️ Lighthouse score
|
### ⛵️ Lighthouse score
|
||||||
|
|
||||||
[![Lighthouse scores](https://lighthouse.now.sh/?perf=100&pwa=100&a11y=100&bp=100&seo=100)](https://travis-ci.com/kremalicious/portfolio)
|
![Lighthouse scores](https://lighthouse.now.sh/?perf=100&pwa=100&a11y=100&bp=100&seo=100)
|
||||||
|
|
||||||
### 💍 One data file to rule all pages
|
### 💍 One data file to rule all pages
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ All SVG assets under `src/images/` will be converted to React components with th
|
|||||||
```js
|
```js
|
||||||
import { ReactComponent as Logo } from './components/svg/Logo'
|
import { ReactComponent as Logo } from './components/svg/Logo'
|
||||||
|
|
||||||
<Logo />
|
return <Logo />
|
||||||
```
|
```
|
||||||
|
|
||||||
### 🍬 Typekit component
|
### 🍬 Typekit component
|
||||||
@ -167,7 +167,7 @@ Then continue modifying the new entry in [`data/projects.yml`](data/projects.yml
|
|||||||
|
|
||||||
Finally, add as many images as needed with the file name format and put into `src/images/`:
|
Finally, add as many images as needed with the file name format and put into `src/images/`:
|
||||||
|
|
||||||
```
|
```text
|
||||||
portfolio-SLUG-01.png
|
portfolio-SLUG-01.png
|
||||||
portfolio-SLUG-02.png
|
portfolio-SLUG-02.png
|
||||||
portfolio-SLUG-03.png
|
portfolio-SLUG-03.png
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"dev": "./node_modules/gatsby/dist/bin/gatsby.js develop --host 0.0.0.0",
|
"dev": "./node_modules/gatsby/dist/bin/gatsby.js develop --host 0.0.0.0",
|
||||||
"format": "prettier --write 'src/**/*.{js,jsx}'",
|
"format": "prettier --write 'src/**/*.{js,jsx}'",
|
||||||
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'",
|
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'",
|
||||||
"test": "npm run lint && ./node_modules/.bin/ava **/*.test.js --verbose",
|
"test": "npm run lint",
|
||||||
"deploy": "./scripts/deploy.sh",
|
"deploy": "./scripts/deploy.sh",
|
||||||
"new": "babel-node ./scripts/new.js"
|
"new": "babel-node ./scripts/new.js"
|
||||||
},
|
},
|
||||||
@ -56,19 +56,15 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.2.2",
|
"@babel/core": "^7.2.2",
|
||||||
"@babel/node": "^7.2.2",
|
"@babel/node": "^7.2.2",
|
||||||
"@babel/polyfill": "^7.2.5",
|
|
||||||
"@babel/preset-env": "^7.2.3",
|
"@babel/preset-env": "^7.2.3",
|
||||||
"@svgr/webpack": "^4.1.0",
|
"@svgr/webpack": "^4.1.0",
|
||||||
"ava": "^1.1.0",
|
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"chrome-launcher": "^0.10.5",
|
|
||||||
"eslint": "^5.12.1",
|
"eslint": "^5.12.1",
|
||||||
"eslint-config-prettier": "^3.6.0",
|
"eslint-config-prettier": "^3.6.0",
|
||||||
"eslint-loader": "^2.1.1",
|
"eslint-loader": "^2.1.1",
|
||||||
"eslint-plugin-graphql": "^3.0.1",
|
"eslint-plugin-graphql": "^3.0.1",
|
||||||
"eslint-plugin-prettier": "^3.0.1",
|
"eslint-plugin-prettier": "^3.0.1",
|
||||||
"eslint-plugin-react": "^7.12.4",
|
"eslint-plugin-react": "^7.12.4",
|
||||||
"lighthouse": "^4.0.0",
|
|
||||||
"ora": "^3.0.0",
|
"ora": "^3.0.0",
|
||||||
"prepend": "^1.0.2",
|
"prepend": "^1.0.2",
|
||||||
"prettier": "^1.16.0",
|
"prettier": "^1.16.0",
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
import '@babel/polyfill'
|
|
||||||
import * as chromeLauncher from 'chrome-launcher'
|
|
||||||
import test from 'ava'
|
|
||||||
import lighthouse from 'lighthouse'
|
|
||||||
import { siteMetadata } from '../gatsby-config'
|
|
||||||
|
|
||||||
const launchChromeAndRunLighthouse = (
|
|
||||||
url,
|
|
||||||
opts = { chromeFlags: ['--headless'] },
|
|
||||||
config = null
|
|
||||||
) =>
|
|
||||||
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(
|
|
||||||
({ categories }) => categories
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
const logScore = score => `Is ${score * 100}.`
|
|
||||||
|
|
||||||
const testOutput = (t, metric) => {
|
|
||||||
const { score } = scores[metric]
|
|
||||||
t.log(logScore(score))
|
|
||||||
return score >= 0.9 ? t.pass() : t.fail()
|
|
||||||
}
|
|
||||||
|
|
||||||
test('Performance Score above 90', t => {
|
|
||||||
testOutput(t, 'performance')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('PWA Score above 90', t => {
|
|
||||||
testOutput(t, 'pwa')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Accessibility Score above 90', t => {
|
|
||||||
testOutput(t, 'accessibility')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Best Practices Score above 90', t => {
|
|
||||||
testOutput(t, 'best-practices')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('SEO Score above 90', t => {
|
|
||||||
testOutput(t, 'seo')
|
|
||||||
})
|
|
Loading…
Reference in New Issue
Block a user