@@ -7,6 +7,7 @@ type Options = {
77 failOnWarning ?: boolean
88 failOnError ?: boolean
99 output ?: string
10+ ignoreNotFound ?: boolean
1011}
1112
1213export async function validate ( filePath : string , options : Options ) {
@@ -26,8 +27,13 @@ export async function validate(filePath: string, options: Options) {
2627 console . log ( prefix , `✅ ${ check . url } (${ check . identifier } )` )
2728 }
2829 } 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+ }
3137 }
3238 if ( check . fragment ) {
3339 if ( check . fragmentFound ) {
@@ -58,7 +64,16 @@ export async function validate(filePath: string, options: Options) {
5864 chalk . yellow ( T ( 'Redirects' ) ) ,
5965 checks . filter ( ( check ) => check . found && check . redirect ) . length ,
6066 )
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+ }
6277 console . log (
6378 chalk . red ( T ( 'Failing fragments' ) ) ,
6479 checks . filter ( ( check ) => check . found && check . fragment && ! check . fragmentFound ) . length ,
0 commit comments