Skip to content

Commit

Permalink
lighthouse tests fully updated
Browse files Browse the repository at this point in the history
  • Loading branch information
alessioventuriniAND committed Sep 17, 2024
1 parent e5395ea commit ea1ae27
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ backstop_data/bitmaps_test/
backstop_data/html_report/
backstop.config-for-docker.json

# Generated from lighthouse tests
.lighthouseci/
lighthouse/urls.json

# npm package folders
/components/
/page-templates/
Expand Down
7 changes: 4 additions & 3 deletions lighthouse/lighthouse-get-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ async function getURLs() {
for (const directory of directories) {
const folders = await readdir(directory.path);
for (const folder of folders) {
const files = await glob(`${directory.path}/${folder}/**/*.html`, { ignore: `${directory.path}/${folder}/index.html` });
for (const file of files) {
data.urls.push(file.replace('build/', 'http://localhost:9000/'));
const files = await glob(`${directory.path}/${folder}/**/*.html`);
const filteredFiles = files.filter((path) => !path.includes('index.html') && !path.includes('example-skip-to-content.html'));
for (const file of filteredFiles) {
data.urls.push(file.replace('build/', 'http://localhost/'));
}
}
}
Expand Down
42 changes: 0 additions & 42 deletions lighthouse/lighthouse.sh

This file was deleted.

3 changes: 2 additions & 1 deletion lighthouse/lighthouserc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
ci: {
collect: {
url: require('./lighthouse/urls.json').urls,
staticDistDir: './build',
url: require('./urls.json').urls,
numberOfRuns: 1,
settings: {
onlyCategories: ['accessibility'],
Expand Down
1 change: 0 additions & 1 deletion lighthouse/urls.json

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test:no-build": "TEST_PORT=3020 TEST_WITH_PUPPETEER=1 jest '.*\\.spec\\.js'",
"test:with-log": "yarn test --no-color 2>test.log",
"test:start-server": "TEST_PORT=3020 gulp start-dev-server",
"test-lighthouse": "yarn build && node ./lighthouse/lighthouse-get-urls.js && lhci autorun --config=./lighthouse/lighthouserc.js",
"build": "yarn && yarn tidy-clean && NODE_ENV=production gulp build",
"build-serve": "yarn build && gulp start-dev-server",
"npm-bundle": "NODE_ENV=production yarn tidy-clean && NODE_ENV=production gulp build-package && babel-node ci/generate-npm-package.js",
Expand Down

0 comments on commit ea1ae27

Please sign in to comment.