MCPcopy Create free account
hub / github.com/adobe/react-spectrum / failTestOnConsoleWarn

Function failTestOnConsoleWarn

scripts/setupTests.js:70–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70function failTestOnConsoleWarn() {
71 const warn = console.warn;
72
73 console.warn = function (message) {
74 const allowedPattern =
75 typeof message === 'string' &&
76 WARNING_PATTERNS_WE_SHOULD_FIX_BUT_ALLOW.find(pattern => matchesPattern(message, pattern));
77
78 if (allowedPattern) {
79 return;
80 }
81
82 warn.apply(console, arguments);
83 throw message instanceof Error ? message : new Error(message);
84 };
85}
86
87expect.extend({
88 toContainObject(received, argument) {

Callers 1

setupTests.jsFile · 0.85

Calls 1

matchesPatternFunction · 0.85

Tested by

no test coverage detected