-
Notifications
You must be signed in to change notification settings - Fork 45
/
lighthouserc.cjs
112 lines (109 loc) · 3.34 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
// LHCI currently does not support .cjs, so generate a json config with:
// node -e 'console.log(JSON.stringify(require("./lighthouserc.cjs"), null, 2))' > lighthouserc.json
module.exports = {
ci: {
upload: {
target: 'temporary-public-storage',
},
collect: {
staticDistDir: './lighthouse-ci/mock-pages',
settings: {
// Only run ads and performance categories.
onlyCategories: ['lighthouse-plugin-publisher-ads', 'performance'],
plugins: ['lighthouse-plugin-publisher-ads'],
},
},
assert: {
assertMatrix: [
{
matchingUrlPattern: '.*/fast-ads.html',
assertions: {
// Plugin category assertions.
'categories:lighthouse-plugin-publisher-ads': [
'error',
{'minScore': 1}, // No failing plugin audits.
],
// Assert that specific metrics fall within desired range.
'tag-load-time': [
'error',
{
'maxNumericValue': 2850, // <= 2.85s
},
],
'ad-request-from-page-start': [
'error',
{
'maxNumericValue': 2800, // <= 2.8s
},
],
'first-ad-render': [
'error',
{'maxNumericValue': 3300}, // <= 3.3s
],
// Performance category assertions.
'categories:performance': [
'error',
{'minScore': .85},
],
// Assert that specific metrics fall within desired range.
'first-contentful-paint': [
'error',
{'maxNumericValue': 750}, // <= .75s
],
'speed-index': [
'error',
{'maxNumericValue': 2000}, // <= 2s
],
'largest-contentful-paint': [
'error',
{'maxNumericValue': 750}, // <= .75s
],
'interactive': [
'error',
{'maxNumericValue': 5000},
],
'total-blocking-time': [
'error',
{'maxNumericValue': 750}, // <= .75s
],
'cumulative-layout-shift': [
'error',
{'maxNumericValue': 0},
],
},
},
{
matchingUrlPattern: '.*/slow-ads.html',
assertions: {
// Plugin category assertions.
'categories:lighthouse-plugin-publisher-ads': [
'error',
{'minScore': .2}, // <= 20% score
],
// Assert that specific metrics fall within desired range.
'ad-request-from-page-start': [
'error',
{'maxNumericValue': 24000}, // <= 24s
],
'first-ad-render': [
'error',
{'maxNumericValue': 27000}, // <= 27s
],
'cumulative-layout-shift': [
'error',
{'maxNumericValue': 3.54}, // <= 3.54
],
'viewport-ad-density': [
'error',
{'maxNumericValue': .33}, // <= 33% density
],
'ad-blocking-tasks': [
'error',
{'maxLength': 2}, // No more than 2 blocking tasks.
],
},
},
],
},
},
};