@@ -34,16 +34,18 @@ function buildCommand(yargs) {
34
34
} ) ;
35
35
}
36
36
37
- /** @type {Array<{id?: string, label: string, test: (opts: LHCI.YargsOptions) => Promise<boolean>|boolean, shouldTest: (opts: LHCI.YargsOptions) => boolean}> } */
37
+ /** @type {Array<{id?: string, label: string, failureLabel: string, test: (opts: LHCI.YargsOptions) => Promise<boolean>|boolean, shouldTest: (opts: LHCI.YargsOptions) => boolean}> } */
38
38
const checks = [
39
39
{
40
40
label : '.lighthouseci/ directory writable' ,
41
+ failureLabel : '.lighthouseci/ directory not writable' ,
41
42
shouldTest : ( ) => true ,
42
43
test : ( ) => loadSavedLHRs ( ) . length >= 0 ,
43
44
} ,
44
45
{
45
46
id : 'rcFile' ,
46
47
label : 'Configuration file found' ,
48
+ failureLabel : 'Configuration file not found' ,
47
49
shouldTest : ( ) => true ,
48
50
test : opts => {
49
51
const rcFile = resolveRcFilePath ( opts . config ) ;
@@ -54,20 +56,23 @@ const checks = [
54
56
{
55
57
id : 'githubToken' ,
56
58
label : 'GitHub token set' ,
59
+ failureLabel : 'GitHub token not set' ,
57
60
// the test only makes sense if they've configured an upload target of some sort
58
61
shouldTest : opts => ! ! opts . target || ! ! opts . serverBaseUrl ,
59
62
test : opts => Boolean ( opts . githubToken || opts . githubAppToken ) ,
60
63
} ,
61
64
{
62
65
id : 'lhciServer' ,
63
66
label : 'Ancestor hash determinable' ,
67
+ failureLabel : 'Ancestor hash not determinable' ,
64
68
// the test only makes sense if they've configured an LHCI server
65
69
shouldTest : opts => Boolean ( opts . serverBaseUrl && opts . token ) ,
66
70
test : ( ) => getAncestorHash ( ) . length > 0 ,
67
71
} ,
68
72
{
69
73
id : 'lhciServer' ,
70
74
label : 'LHCI server reachable' ,
75
+ failureLabel : 'LHCI server not reachable' ,
71
76
// the test only makes sense if they've configured an LHCI server
72
77
shouldTest : opts => Boolean ( opts . serverBaseUrl && opts . token ) ,
73
78
test : async ( { serverBaseUrl = '' } ) =>
@@ -76,6 +81,7 @@ const checks = [
76
81
{
77
82
id : 'lhciServer' ,
78
83
label : 'LHCI server token valid' ,
84
+ failureLabel : 'LHCI server token invalid' ,
79
85
// the test only makes sense if they've configured an LHCI server
80
86
shouldTest : opts => Boolean ( opts . serverBaseUrl && opts . token ) ,
81
87
test : async ( { serverBaseUrl = '' , token = '' } ) => {
@@ -87,6 +93,7 @@ const checks = [
87
93
{
88
94
id : 'lhciServer' ,
89
95
label : 'LHCI server unique build for this hash' ,
96
+ failureLabel : 'LHCI server non-unique build for this hash' ,
90
97
// the test only makes sense if they've configured an LHCI server
91
98
shouldTest : opts => Boolean ( opts . serverBaseUrl && opts . token ) ,
92
99
test : async ( { serverBaseUrl = '' , token = '' } ) => {
@@ -124,8 +131,9 @@ async function runCommand(options) {
124
131
125
132
const isWarn = ! ! check . id && ! checkIdsToRun . includes ( check . id ) ;
126
133
const icon = result ? PASS_ICON : isWarn ? WARN_ICON : FAIL_ICON ;
134
+ const label = result ? check . label : check . failureLabel ;
127
135
allPassed = allPassed && ( isWarn || result ) ;
128
- process . stdout . write ( `${ icon } ${ check . label } ${ message } \n` ) ;
136
+ process . stdout . write ( `${ icon } ${ label } ${ message } \n` ) ;
129
137
}
130
138
131
139
if ( allPassed ) {
0 commit comments