-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlighthouserc.cjs
179 lines (177 loc) · 6.51 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// A list of pages which have custom rules.
const PAGES_NONSTANDARD_RULES = [
'news',
'storage',
'events',
'auth',
'rules',
'shift-schedule',
];
// 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: {
settings: {
hostname: '127.0.0.1',
},
url: [
'http://localhost:3000/en/', // Trailing slash required, else the regex for default lighthouse rules won't catch this one
'http://localhost:3000/en/auth',
'http://localhost:3000/en/about',
'http://localhost:3000/en/events',
'http://localhost:3000/en/events/1',
'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',
'http://localhost:3000/en/rules',
'http://localhost:3000/en/rules/1',
],
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_NONSTANDARD_RULES.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',
'unused-javascript': 'off',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': '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',
'unused-javascript': 'off',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': '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
},
},
{
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',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': '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
'image-aspect-ratio': 'off', // Should be removed when we obtain images from backend
},
},
{
matchingUrlPattern: 'http://.*/en/events.*',
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',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': 'off',
'uses-responsive-images': 'off', // Should be removed when we obtain images from backend
'label-content-name-mismatch': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/auth.*',
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',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': 'off',
'document-title': 'off',
'font-size': 'off',
viewport: 'off',
'meta-description': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/rules.*',
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',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': 'off',
'image-redundant-alt': 'off',
'label-content-name-mismatch': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/shift-schedule.*',
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',
interactive: 'off',
'mainthread-work-breakdown': 'off',
'max-potential-fid': 'off',
'bootup-time': 'off',
'errors-in-console': 'off', // Preloading fonts causes errors in console
},
},
],
},
},
};
module.exports = config;