File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
packages/internal-test-utils Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -418,13 +418,18 @@ export function createLogAssertion(
418418 let argIndex = 0 ;
419419 // console.* could have been called with a non-string e.g. `console.error(new Error())`
420420 // eslint-disable-next-line react-internal/safe-string-coercion
421- String ( format ) . replace ( / % s / g, ( ) => argIndex ++ ) ;
421+ String ( format ) . replace ( / % s | % c / g, ( ) => argIndex ++ ) ;
422422 if ( argIndex !== args . length ) {
423- logsMismatchingFormat . push ( {
424- format,
425- args,
426- expectedArgCount : argIndex ,
427- } ) ;
423+ if ( format . includes ( '%c%s' ) ) {
424+ // We intentionally use mismatching formatting when printing badging because we don't know
425+ // the best default to use for different types because the default varies by platform.
426+ } else {
427+ logsMismatchingFormat . push ( {
428+ format,
429+ args,
430+ expectedArgCount : argIndex ,
431+ } ) ;
432+ }
428433 }
429434
430435 // Check for extra component stacks
You can’t perform that action at this time.
0 commit comments