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

Function failTestOnConsoleError

scripts/setupTests.js:46–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44const WARNING_PATTERNS_WE_SHOULD_FIX_BUT_ALLOW = ['Browserslist: caniuse-lite is outdated'];
45
46function failTestOnConsoleError() {
47 const error = console.error;
48
49 console.error = function (message) {
50 const allowedPattern =
51 typeof message === 'string' &&
52 ERROR_PATTERNS_WE_SHOULD_FIX_BUT_ALLOW.find(pattern => message.indexOf(pattern) > -1);
53 if (allowedPattern) {
54 return;
55 }
56
57 error.apply(console, arguments);
58 throw message instanceof Error ? message : new Error(message);
59 };
60}
61
62function failTestOnConsoleWarn() {
63 const warn = console.warn;

Callers 1

setupTests.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected