@@ -5,7 +5,7 @@ import chalk from 'chalk';
55import { logger } from '../common-utils' ;
66import { configDefaults , DiffModeId , DiffModes , SaveFormat , ViewMode } from '../constants' ;
77import { assertCustomGui } from './custom-gui-asserts' ;
8- import { ErrorPattern , PluginDescription , ReporterConfig , ReporterOptions } from '../types' ;
8+ import { GenerateBadges , ErrorPattern , PluginDescription , ReporterConfig , ReporterOptions } from '../types' ;
99import { UiMode } from '../constants/local-storage' ;
1010
1111const ENV_PREFIX = 'html_reporter_' ;
@@ -28,6 +28,7 @@ const assertType = <T>(name: string, validationFn: (value: unknown) => value is
2828 } ;
2929} ;
3030const assertString = ( name : string ) : AssertionFn < string > => assertType ( name , _ . isString , 'string' ) ;
31+ const assertFunction = ( name : string ) : AssertionFn < string > => assertType ( name , _ . isFunction , 'function' ) ;
3132const assertBoolean = ( name : string ) : AssertionFn < boolean > => assertType ( name , _ . isBoolean , 'boolean' ) ;
3233export const assertNumber = ( name : string ) : AssertionFn < number > => assertType ( name , _ . isNumber , 'number' ) ;
3334const assertPlainObject = ( name : string ) : AssertionFn < Record < string , unknown > > => assertType ( name , isPlainObject , 'plain object' ) ;
@@ -287,6 +288,10 @@ const getParser = (): ReturnType<typeof root<ReporterConfig>> => {
287288 parseCli : JSON . parse ,
288289 validate : assertPlainObject ( 'staticImageAccepter.axiosRequestOptions' )
289290 } )
291+ } ) ,
292+ generateBadges : option < GenerateBadges | null > ( {
293+ defaultValue : configDefaults . generateBadges ,
294+ validate : ( value ) => _ . isNull ( value ) || assertFunction ( 'generateBadges' )
290295 } )
291296 } ) , { envPrefix : ENV_PREFIX , cliPrefix : CLI_PREFIX } ) ;
292297} ;
0 commit comments