-
Notifications
You must be signed in to change notification settings - Fork 0
/
lighthouserc.cjs
76 lines (74 loc) · 3 KB
/
lighthouserc.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const PAGES_EXCLUDED = ['news', 'storage'];
// Do not convert into an ES6 export.
// lighthouse-ci (as of 0.14.0) uses require() to import, and this is not supported with ES6 modules.
const config = {
ci: {
collect: {
url: [
'http://localhost:3000/en/', // Trailing slash required, else the regex for default lighthouse rules won't catch this one
'http://localhost:3000/en/about',
'http://localhost:3000/en/events',
'http://localhost:3000/en/news',
'http://localhost:3000/en/news/1',
'http://localhost:3000/en/storage',
'http://localhost:3000/en/storage/shopping-cart',
'http://localhost:3000/en/shift-schedule',
],
startServerCommand: 'bun run start',
},
upload: {
target: 'lhci',
serverBaseUrl: 'https://lhci.hackerspace-ntnu.no', // build token is set by the GH Action
},
assert: {
assertMatrix: [
{
matchingUrlPattern: `http://.*/en/(?!${PAGES_EXCLUDED.join('|')}).*`, // match all routes, except for pages with special rules. See https://github.com/GoogleChrome/lighthouse-ci/issues/511 and https://github.com/GoogleChrome/lighthouse-ci/issues/208#issuecomment-784501105
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
'target-size': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/news.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
'target-size': 'off',
interactive: 'off',
'uses-responsive-images': 'off', // Should be removed when we obtain images from backend
'image-aspect-ratio': 'off', // Should be removed when we obtain images from backend
'image-size-responsive': 'off', // Should be removed when we obtain images from backend
'max-potential-fid': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/storage.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
'target-size': 'off',
'unused-javascript': 'off',
'cumulative-layout-shift': 'off', // We don't always know how many items are in the cart, which can lead to layout shifts when loading completes
'max-potential-fid': 'off',
'image-aspect-ratio': 'off', // Should be removed when we obtain images from backend
},
},
],
},
},
};
module.exports = config;