mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Merge pull request #17932 from strapi/chore/improve-test-logging
chore(admin-test-utils): swallow styled-components transient errors
This commit is contained in:
commit
0ae34ba59b
@ -35,12 +35,19 @@ const error = console.error;
|
||||
window.console = {
|
||||
...window.console,
|
||||
error(...args: any[]) {
|
||||
error(...args);
|
||||
|
||||
const message = format(...args);
|
||||
|
||||
if (/(Invalid prop|Failed prop type)/gi.test(message)) {
|
||||
throw new Error(message);
|
||||
|
||||
// Ignore errors thrown by styled-components. This can be removed once we upgrade
|
||||
// to styled-components@6 and have separate props that are rendered in the DOM by
|
||||
// the ones that aren't using the $ prefix.
|
||||
// https://styled-components.com/docs/faqs#transient-as-and-forwardedas-props-have-been-dropped
|
||||
} else if (/React does not recognize the .* prop on a DOM element/.test(message)) {
|
||||
// do nothing
|
||||
} else {
|
||||
error(...args);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user