@@ -7,6 +7,7 @@ type Options = {
7
7
failOnWarning ?: boolean
8
8
failOnError ?: boolean
9
9
output ?: string
10
+ ignoreNotFound ?: boolean
10
11
}
11
12
12
13
export async function validate ( filePath : string , options : Options ) {
@@ -26,8 +27,13 @@ export async function validate(filePath: string, options: Options) {
26
27
console . log ( prefix , `✅ ${ check . url } (${ check . identifier } )` )
27
28
}
28
29
} else {
29
- if ( options . failOnError ) exitCode ++
30
- console . log ( prefix , `❌ ${ check . url } (${ check . identifier } )` )
30
+ // This is a 404 - page not found
31
+ if ( options . ignoreNotFound ) {
32
+ console . log ( prefix , `⚠️ ${ check . url } (${ check . identifier } )` )
33
+ } else {
34
+ if ( options . failOnError ) exitCode ++
35
+ console . log ( prefix , `❌ ${ check . url } (${ check . identifier } )` )
36
+ }
31
37
}
32
38
if ( check . fragment ) {
33
39
if ( check . fragmentFound ) {
@@ -58,7 +64,16 @@ export async function validate(filePath: string, options: Options) {
58
64
chalk . yellow ( T ( 'Redirects' ) ) ,
59
65
checks . filter ( ( check ) => check . found && check . redirect ) . length ,
60
66
)
61
- console . log ( chalk . red ( T ( 'Failures' ) ) , checks . filter ( ( check ) => ! check . found ) . length )
67
+ const notFoundChecks = checks . filter ( ( check ) => ! check . found )
68
+
69
+ if ( options . ignoreNotFound ) {
70
+ console . log ( chalk . red ( T ( 'Failures' ) ) , 0 )
71
+ if ( notFoundChecks . length > 0 ) {
72
+ console . log ( chalk . yellow ( T ( 'Ignored (404s)' ) ) , notFoundChecks . length )
73
+ }
74
+ } else {
75
+ console . log ( chalk . red ( T ( 'Failures' ) ) , notFoundChecks . length )
76
+ }
62
77
console . log (
63
78
chalk . red ( T ( 'Failing fragments' ) ) ,
64
79
checks . filter ( ( check ) => check . found && check . fragment && ! check . fragmentFound ) . length ,
0 commit comments